The following source results in a warning, "foo.py:4: Using method (debug) as an attribute (not invoked)". But the debug method is being invoked normally (as can be seen by instantiating the class and calling _got_response with various arguments). I think pychecker is confused by the ternary-if expression, not sure. Tested with pychecker-0.8.19 and Python 2.7.3.
class Foo (object):
def _got_response(self, recvdone):
if recvdone is not None:
self.debug('<-- done ' + ( '(success)' if recvdone is True else repr(recvdone) ))
def debug(self, msg):
print msg
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
I have a similar case where the second non-self argument to a method is a list comprehension, and I get the same "Using method (foo) as an attribute (not invoked)" warning. If I assign the result of the list comprehension to an intermediate and pass that instead, the warning goes away.
Last edit: Anonymous 2013-08-29