[New-bugs-announce] [issue24796] Deleting names referencing from enclosed and enclosing scopes

Nick Coghlan report at bugs.python.org
Wed Aug 5 15:05:17 CEST 2015


New submission from Nick Coghlan:

While committing issue #24129, I noticed the following in the execution model documentation:

==================
If a variable is referenced in an enclosing scope, it is illegal to delete the name. An error will be reported at compile time.
==================

I'm not sure what that means, as both of the following compiled fine for me under 3.4.2:

>>> def f():
...     x = 1
...     def g():
...         nonlocal x
...         del x
... 
>>> def f():
...     x = 1
...     del x
...     def g():
...         print(x)
...

----------
assignee: docs at python
components: Documentation
messages: 248036
nosy: docs at python, ncoghlan
priority: normal
severity: normal
status: open
title: Deleting names referencing from enclosed and enclosing scopes

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24796>
_______________________________________


More information about the New-bugs-announce mailing list