On 05 novembre 14:35, James Lingard wrote:
> The following program:
> 
>    def f():
>       g = lambda: x
>       x = 1
>       print g()
> 
> generates the following unnecessary error:
> 
>    E0601:  2:f.<lambda>: Using variable 'x' before assignment
> 
> Note that the following program doesn't generate the error:
> 
>    def f():
>       def g(): return x
>       x = 1
>       print g()
> 
> I think it would make sense for this warning to treat lambda expressions the
> same as function definitions.

yup, filed in http://www.logilab.org/ticket/18862

thanks for the report, regards
-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org

_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to