Message113335
I have changed my mind on this issue. Since
e = 1
del e
def g(): print(e)
g()
compiles and raises a run-time name error, so should the same code embedded within a function. In either case, the premature deletion is a logic error, not a syntax error.
However, changing the language definition, even to fix what is considered a design bug, is a feature request. For both 2.7 and 3.1, section 6.5. "The del statement", says "It is illegal to delete a name from the local namespace if it occurs as a free variable in a nested block."
So this seems too late for 2.7. On the other hand, Guido has allowed it for 3.2 in spite of the moratorium, but I think it should go in the initial release. |
|
Date |
User |
Action |
Args |
2010-08-08 21:58:05 | terry.reedy | set | recipients:
+ terry.reedy, gvanrossum, jhylton, rhettinger, pje, amaury.forgeotdarc, scoder, benjamin.peterson, ezio.melotti, cmcqueen1975, flox |
2010-08-08 21:58:05 | terry.reedy | set | messageid: <1281304685.25.0.14700791126.issue4617@psf.upfronthosting.co.za> |
2010-08-08 21:58:04 | terry.reedy | link | issue4617 messages |
2010-08-08 21:58:03 | terry.reedy | create | |
|