This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients amaury.forgeotdarc, benjamin.peterson, cmcqueen1975, ezio.melotti, flox, gvanrossum, jhylton, pje, rhettinger, scoder, terry.reedy
Date 2010-08-08.21:58:03
SpamBayes Score 5.288435e-10
Marked as misclassified No
Message-id <1281304685.25.0.14700791126.issue4617@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-08-08 21:58:05terry.reedysetrecipients: + terry.reedy, gvanrossum, jhylton, rhettinger, pje, amaury.forgeotdarc, scoder, benjamin.peterson, ezio.melotti, cmcqueen1975, flox
2010-08-08 21:58:05terry.reedysetmessageid: <1281304685.25.0.14700791126.issue4617@psf.upfronthosting.co.za>
2010-08-08 21:58:04terry.reedylinkissue4617 messages
2010-08-08 21:58:03terry.reedycreate