Terry Reedy writes:

> definitions. Lambda expressions create functions just like def
> statements and are not closures and do not create closure unless
> nested within another function definition. Thinking otherwise is

Seems quite closed in the top level environment to me:

   Python 2.3.4 (#1, Jul 16 2009, 07:03:37) 
   >>> k = 'outer'
   >>> f = lambda : k
   >>> def test():
   ...   k = 'inner'
   ...   return f()
   ... 
   >>> test()
   'outer'
   >>> k = 'thing'
   >>> test()
   'thing'
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to