[Python-projects] Can pylint be informed that a method is called by AClass.__init__ () ?

Sylvain Thénault sylvain.thenault at logilab.fr
Wed May 17 22:05:15 CEST 2006


On Wednesday 17 May à 14:39, Pierre_Rouleau at ImpathNetworks.com wrote:
> Bonjour à tous,

Bonjour Pierre,
 
> Pylint (the latest, and previus) generates a W0201 warning when a instance
> attribute is created outside of the class __init__() method even if that method
> is called from __init__().
> 
> I do not want to disable that warning in that particular case.
> 
> Is there a way I can tell Pylint that method xxxx() is called from __init__() so
> it should not complain that xxxx() creates instance attributes?  There are cases
> where it is nice to have one or several methods that create instance attributes
> to clarify the source.

you can do that using the defining-attr-methods option, which default to
__init__, __new__, setUp :). 

-- 
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