[Python-projects] W0631 - False positive (possibly undefined loop variable)

Sylvain Thénault sylvain.thenault at logilab.fr
Tue Dec 16 17:18:37 CET 2008


Le Monday 15 December 2008 23:55:47 Paul `Satoshi' Hachmann, vous avez écrit :
> I believe I've encountered a false positive (W0631) - a minimal test case
> is:
>
> -------------
> for x in []:
>     pass
>
> for x in range(3):
>     print (lambda : x)() # W0631 here
> -------------
>
> Note that removing the first loop, or using 'x' directly, rather than in a
> lambda expression in the second, clears up the false positive.
>
> It's not the same as #2463, since we're only ever using 'x' inside a loop
> (where it obviously must be defined). It might be the same as #6015,
> though.

you're right that's not the same bug. Actually is seems to be a pylint bug and 
I've checked in a fix for this pb.
Thank you for reporting this
-- 
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