[Python-ideas] Allow lambda decorators
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Feb 10 06:25:50 CET 2009
Arnaud Delobelle wrote:
> Cool! I'll be able to introduce a new scope at the drop of a hat with
> a new handy 'idiom':
>
> def foo(x):
> a = x + 1
> for new a in a**2,:
> print a
> print a
Before you get too carried away with that, I'd like
to make it clear that in my version of the semantics
of 'new', it *not* work that way -- 'a' would remain
bound to the last cell, and therefore the last value,
that it was given by the for-loop.
I considered that a feature of my proposal, i.e. it
preserves the ability to use the loop variable's value
after exiting the loop, which some people seem to like.
--
Greg
More information about the Python-ideas
mailing list