On Sunday 29 November 2009 17:53:43 Vincent Legoll wrote: > Hello, > > pylint is reporting the following warning: > > test_pylint_redefine.py:6: [W0621, Abc.__init__] Redefining name > 'param' from outer scope (line 9) > > for the attached python code > > ####################### > class Abc(object): > > def __init__(self, param): > pass > > param = None > ####################### > > Is there really redefining happening here or is this a pylint oversight ? >
Pylint is correct : param on line 6 is defined at the module scope. If you want to use that variable from within the initializer of the Abc class, you can't because it is shadowed by the argument of the same name. -- Alexandre Fayolle LOGILAB, Paris (France) Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services Informatique scientifique: http://www.logilab.fr/science _______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects
