[Python-checkins] CVS: python/dist/src/Misc NEWS,1.132,1.133

Guido van Rossum gvanrossum@users.sourceforge.net
Fri, 02 Mar 2001 06:00:34 -0800


Update of /cvsroot/python/python/dist/src/Misc
In directory usw-pr-cvs1:/tmp/cvs-serv23870

Modified Files:
	NEWS 
Log Message:
Add big news item about nested scopes, __future__, and compile-time
warnings.


Index: NEWS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
retrieving revision 1.132
retrieving revision 1.133
diff -C2 -r1.132 -r1.133
*** NEWS	2001/03/02 06:49:50	1.132
--- NEWS	2001/03/02 14:00:32	1.133
***************
*** 4,7 ****
--- 4,43 ----
  Core language, builtins, and interpreter
  
+ - Following an outcry from the community about the amount of code
+   broken by the nested scopes feature introduced in 2.1a2, we decided
+   to make this feature optional, and to wait until Python 2.2 (or at
+   least 6 months) to make it standard.  The option can be enabled on a
+   per-module basis by adding "from __future__ import nested_scopes" at
+   the beginning of a module (before any other statements, but after
+   comments and an optional docstring).  See PEP 236 (Back to the
+   __future__) for a description of the __future__ statement.  PEP 227
+   (Statically Nested Scopes) has been updated to reflect this change,
+   and to clarify the semantics in a number of endcases.
+ 
+ - The nested scopes code, when enabled, has been hardened, and most
+   bugs and memory leaks in it have been fixed.
+ 
+ - Compile-time warnings are now generated for a number of conditions
+   that will break or change in meaning when nested scopes are enabled:
+ 
+   - Using "from...import *" or "exec" without in-clause in a function
+     scope that also defines a lambda or nested function with one or
+     more free (non-local) variables.  The presence of the import* or
+     bare exec makes it impossible for the compiler to determine the
+     exact set of local variables in the outer scope, which makes it
+     impossible to determine the bindings for free variables in the
+     inner scope.  To avoid the warning about import *, change it into
+     an import of explicitly name object, or move the import* statement
+     to the global scope; to avoid the warning about bare exec, use
+     exec...in... (a good idea anyway -- there's a possibility that
+     bare exec will be deprecated in the future).
+ 
+   - Use of a global variable in a nested scope with the same name as a
+     local variable in a surrounding scope.  This will change in
+     meaning with nested scopes: the name in the inner scope will
+     reference the variable in the outer scope rather than the global
+     of the same name.  To avoid the warning, either rename the outer
+     variable, or use a global statement in the inner function.
+ 
  - An optional object allocator has been included.  This allocator is
    optimized for Python objects and should be faster and use less memory