Re: lambda construction

Tim Peters (tim@ksr.com)
Thu, 23 Jun 94 01:23:09 -0400

> > [working thru a namespace example]

> [ken]
> I was confused in thinking that the global name space for the lambda
> ... was the local name space of the wrap function ...

It's a common confusion! Now you know why I'm keen to change the "fact
sheet" to reduce the explanation of the global NS to the one-line truth.
The ref manual's table is accurate but misleading: all the "NS of
containing block" and "NS of caller" entries in the Global column
strongly imply "ah, so the global NS nests!" to the (even not so) casual
reader.

Replace all that with "the global NS is the module NS", and all the
"containing block" entries in the entire table vanish. Without those,
erroneous ideas about Python's scope nesting are harder to fall into.

BTW, some people who believe that arbitrary nesting of scopes is
essential program in Python for years before they realize Python doesn't
support it <0.8 grin>. The introduction of "lambda" seemed to make this
realization occur a lot earlier than it used to, though.

paul-mccartney-was-in-a-band-before-wings?!-ly y'rs - tim

Tim Peters tim@ksr.com
not speaking for Kendall Square Research Corp