[Python-ideas] Allow lambda decorators

spir denis.spir at free.fr
Tue Feb 10 14:05:30 CET 2009

Le Tue, 10 Feb 2009 18:02:27 +1300,
Greg Ewing <greg.ewing at canterbury.ac.nz> a écrit :

> spir wrote:
> > For instance, using a declaration, it may be possible to write the following loop (I do not pretend 'local' to be a good lexical choice ;-):
> > 
> > funcs = []
> > for item in seq:
> > 	local prod	# this name only is iteration specific
> > 	prod = product(item)	# ==> one prod per item
> My conception of the 'new' idea is that you would be able to
> use it with any assignment to a bare name, so you could write
>    for item in seq:
>      new prod = product(item)
>      ...
Yes, this is different indeed. As Guido's example was to tag the loop variable itself with the kw 'new', then all names inside the loop body depending on it would also be "iteration specific". So that it would not be possible anymore to retrieve final state data outsid the loop as is commonly done in python. Your proposal solves the problems.
Yet, as Guido noted, it is probably not a big issue enough.

la vida e estranya

More information about the Python-ideas mailing list