[Python-projects] PyLint determines class "newness" incorrectly
Sylvain Thénault
sylvain.thenault at logilab.fr
Mon Aug 21 10:43:39 CEST 2006
Hi,
On Thursday 17 August à 15:49, skip at pobox.com wrote:
> Given this little program:
>
> import pygtk
> pygtk.require("2.6")
> import gobject
>
> class A(gobject.GObject):
> def __init__(self, val):
> gobject.GObject.__init__(self)
> self._val = val
>
> def _get_val(self):
> print "get"
> return self._val
>
> def _set_val(self, val):
> print "set"
> self._val = val
>
> val = property(_get_val, _set_val)
>
> if __name__ == "__main__":
> print gobject.GObject.__bases__
> a = A(7)
> print a.val
> a.val = 6
> print a.val
>
> When I run it, I get this output:
>
> (<type 'object'>,)
> get
> 7
> set
> get
> 6
>
> However, PyLint reports:
>
> gobject_subclass.py:8: [W, A.__init__] __init__ method from a non direct base class <logilab.astng.Yes object at 0x8253d4c> is called
> gobject_subclass.py:19: [W, A] Use of "property" on an old style class
>
> It clearly has messed something up about the lineage of the A class. One,
> the logilab.astng.Yes class is not involved with the A class. (I believe I
> reported this before.) Two, A is a new-style class (because gobject.GObject
> is, as the program output demonstrates).
thanks for this valuable report, I've added it to our tracker.
--
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Python et calcul scientifique: http://www.logilab.fr/science
More information about the Python-Projects
mailing list