From c36c28ff72d5a8654b32f25662226f87a91dbff6 Mon Sep 17 00:00:00 2001 From: Chris Angelico Date: Fri, 2 Mar 2018 20:05:31 +1100 Subject: [PATCH] PEP 572: Remove SLNBs from locals() to eliminate confusion --- pep-0572.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pep-0572.rst b/pep-0572.rst index 2539cea73..895692eaf 100644 --- a/pep-0572.rst +++ b/pep-0572.rst @@ -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 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 ------------------------------------ @@ -264,12 +267,7 @@ Discrepancies in the current implementation comprehensions), but not at top level. Making this work at top-level and in class definitions would be very much of value. -2. The interaction with locals() is currently slightly buggy. Ideally, - 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. +2. Assigning 'through' a SLNB is not implemented yet. References