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.

Thanks,
James.
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to