"Unresolved attribute reference" for monkey-patched function

PyCharm says "unresolved attribute reference" for a.f2()

class A:

    def f1(self):

        print 'f1'

def _f2(self):

    print 'f2'

A.f2 = _f2

a = A()

a.f2()

Even though this runs fine. Is this something the developers are aware of? Is it being worked on? Or is it too hard to implement?

The IntelliSense is otherwise awesome!!

2 comments
Comment actions Permalink

Hello Mark,

Yes, we are aware of this problem, and no, there is no general solution for

this which can be implemented. Especially if assigning the attribute is conditional

and/or happens in another module.

PyCharm says "unresolved attribute reference" for a.f2()

class A:
> def f1(self):
> print 'f1'
> def _f2(self):
> print 'f2'
> A.f2 = _f2
> 
> a = A()
> a.f2()

Even though this runs fine. Is this something the developers are aware

of? Is it being worked on? Or is it too hard to implement?

The IntelliSense is otherwise awesome!!

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

1
Comment actions Permalink

Thanks for the reply Dmitry!

I didn't think about it being conditional. I guess there's really nothing you can do about that.

I'm not sure how it being in another module complicates the matter though; you can see if that module is included?

I'll just supress the warning then. I look forward to delving into this IDE further, looks promising!
I've been using Komodo IDE both for PHP and Python/Django, but this one seems way more intelligent.

1

Please sign in to leave a comment.