Not understanding lamdas and scoping

George Sakkis george.sakkis at gmail.com
Wed Mar 26 22:25:31 CET 2008


On Mar 26, 5:02 pm, Joshua Kugler <jkug... at bigfoot.com> wrote:

> I am trying to use lamdba to generate some functions, and it is not working
> the way I'd expect.  The code is below, followed by the results I'm
> getting.  More comments below that.
>
> (...)
>
> So, is there some scoping issue with lambda
> that I'm not seeing?

Yes; it's not related to lambda though but to closures (whether
defined as lambdas or regular functions). See for example
http://groups.google.com/group/comp.lang.python/browse_frm/thread/94d1bba8ad56baf4

There should be an entry for this at http://www.python.org/doc/faq/programming/,
that's really an FAQ.

George



More information about the Python-list mailing list