]> granicus.if.org Git - python/commitdiff
Add news about nonlocal statement
authorJeremy Hylton <jeremy@alum.mit.edu>
Tue, 27 Feb 2007 15:53:28 +0000 (15:53 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Tue, 27 Feb 2007 15:53:28 +0000 (15:53 +0000)
Misc/NEWS

index edb512f0a6134cdfb738c58fe500718ad3f57cc3..e445d3ed5c7531dbfe422b730e404494ef6da979 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -62,6 +62,21 @@ Core and Builtins
 
 - Added function annotations per PEP 3107.
 
+- Added nonlocal declaration from PEP 3104
+
+  >>> def f(x):
+  ...     def inc():
+  ...         nonlocal x
+  ...         x += 1
+  ...         return x
+  ...     return inc
+  ...
+  >>> inc = f(0)
+  >>> inc()
+  1
+  >>> inc()
+  2
+
 - Moved intern() to sys.intern().
 
 - exec is now a function.