[Python-projects] pylint W0142 recommended corrections
Sylvain Thénault
sylvain.thenault at logilab.fr
Fri Jul 13 13:30:58 CEST 2007
On Friday 13 July à 13:29, Amaury Forgeot d'Arc wrote:
> Hello Sylvain,
>
> Sylvain Thénault wrote:
> >On Wednesday 11 July à 09:57, Gurganus, Brant L wrote:
> >> I am working on some Python code where Pylint gives a warning of:
> >> W: 31:ProxyFactory._init_instance: Used * or ** magic
> >>
> >> The basic code is:
> >> def _init_instance(self, *args, **kwargs):
> >> self.__class__._original.__dict__["__init__"](self, *args, **kwargs)
> >>
> >> The only other method in my mind for doing this would be to use apply,
> >but the
> >> *args, **kwargs method appears to be favored over apply right now.
> >>
> >> Is there a recommended way to correct this or is this a case where
> >silencing
> >> the warning is a better solution?
> >
> >well, pylint flag * or ** usage to avoid abuse of this construction, but
> >it's still useful or necessary sometimes, as probably in your case, so
> >you can silence it i think.
>
> IMO, just receiving and passing *args, **kwargs "as is" is not magic,
> as long as they are not used at all (no change, and no item access).
>
> I use *args and **kwargs almost exclusively this way.
> I see it as a way to redirect a function call, with no change to the
> arguments.
>
> Do you think that the warning could be silenced in this case?
that would probably be a good idea. Opening a ticket :)
--
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