[Python-projects] Pylint: W0212 (access to protected member) false negative
Sylvain Thénault
sylvain.thenault at logilab.fr
Thu Jan 22 09:06:47 CET 2009
Le Wednesday 21 January 2009 19:42:31 Paul `Satoshi' Hachmann, vous avez
écrit :
> In the following code, the '_secret' protected member of SomeClass
> is accessed twice; once to set it and another to print it:
>
> --------------
> class SomeClass(object):
> def __init__(self):
> self._secret = 3
>
>
> obj = SomeClass()
> obj._secret = 1 # Doesn't catch this!
> print "I am accessing", obj._secret # Produces W0212, as expected
> --------------
>
> However, the assignment statement by itself doesn't generate a W0212.
well, strictly speaking an assignement is an assigment, not an access :p
Though I agree we could wish to have W0212 emited in such cases. I've added a
ticket for this: http://www.logilab.org/ticket/7394
--
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