PEP 572: Remove SLNBs from locals() to eliminate confusion

This commit is contained in:
Chris Angelico 2018-03-02 20:05:31 +11:00
parent 0b1c874bd5
commit c36c28ff72
1 changed files with 4 additions and 6 deletions

View File

@ -49,6 +49,9 @@ Assignment to statement-local names is ONLY through this syntax. Regular
assignment to the same name will remove the statement-local name and assignment to the same name will remove the statement-local name and
affect the name in the surrounding scope (function, class, or module). affect the name in the surrounding scope (function, class, or module).
Statement-local names never appear in locals() or globals().
Execution order and its consequences Execution order and its consequences
------------------------------------ ------------------------------------
@ -264,12 +267,7 @@ Discrepancies in the current implementation
comprehensions), but not at top level. Making this work at top-level comprehensions), but not at top level. Making this work at top-level
and in class definitions would be very much of value. and in class definitions would be very much of value.
2. The interaction with locals() is currently slightly buggy. Ideally, 2. Assigning 'through' a SLNB is not implemented yet.
statement-local names will appear in locals() while they are active (and
shadow any other names from the same function); as an alternative, they
could simply never appear, even when in scope.
3. Assigning 'through' a SLNB is not implemented yet.
References References