[Python-projects] PyLint: Type inference fails on classmethod
Maarten ter Huurne
maarten.ter.huurne at philips.com
Tue Feb 6 19:40:04 CET 2007
Hi,
When I run PyLint on this program:
===
class Super(object):
@classmethod
def instance(cls):
return cls()
class Sub(Super):
def method(self):
print 'method called'
Sub.instance().method()
===
It prints:
===
E1101: 10: Instance of 'Super' has no 'method' member
===
The return type of "Sub.instance()" is "Sub", not "Super", so the method
call is valid, as you can see when you run this program.
So it seems that ASTNG infers the wrong type: "cls" is the class on which
the class method is called, which is not necessarily the class in which it
is defined.
Bye,
Maarten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.logilab.org/pipermail/python-projects/attachments/20070206/cd8cb2c4/attachment.html
More information about the Python-Projects
mailing list