[Python-checkins] CVS: python/dist/src/Lib __future__.py,1.9,1.10

Tim Peters tim_one@users.sourceforge.net
2001年8月18日 13:18:51 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv5565/python/Lib
Modified Files:
	__future__.py 
Log Message:
Expose the CO_xxx flags via the "new" module (re-solving a problem "the
right way"). Fiddle __future__.py to use them.
Jeremy's pyassem.py may also want to use them (by-hand duplication of
magic numbers is brittle), but leaving that to his judgment.
Beef up __future__'s test to verify the exported feature names appear
correct.
Index: __future__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/__future__.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** __future__.py	2001年08月17日 19:49:02	1.9
--- __future__.py	2001年08月18日 20:18:49	1.10
***************
*** 56,67 ****
 __all__ = ["all_feature_names"] + all_feature_names
 
! 
! # The CO_xxx symbols are defined here under the same names used by
! # compile.h, so that an editor search will find them here. However,
! # they're not exported in __all__, because they don't really belong to
! # this module.
! CO_NESTED = 0x0010 # nested_scopes
! CO_GENERATOR_ALLOWED = 0x1000 # generators
! CO_FUTURE_DIVISION = 0x2000 # division
 
 class _Feature:
--- 56,60 ----
 __all__ = ["all_feature_names"] + all_feature_names
 
! import new as _new # for CO_xxx symbols
 
 class _Feature:
***************
*** 94,104 ****
 nested_scopes = _Feature((2, 1, 0, "beta", 1),
 (2, 2, 0, "alpha", 0),
! CO_NESTED)
 
 generators = _Feature((2, 2, 0, "alpha", 1),
 (2, 3, 0, "final", 0),
! CO_GENERATOR_ALLOWED)
 
 division = _Feature((2, 2, 0, "alpha", 2),
 (3, 0, 0, "alpha", 0),
! CO_FUTURE_DIVISION)
--- 87,97 ----
 nested_scopes = _Feature((2, 1, 0, "beta", 1),
 (2, 2, 0, "alpha", 0),
! _new.CO_NESTED)
 
 generators = _Feature((2, 2, 0, "alpha", 1),
 (2, 3, 0, "final", 0),
! _new.CO_GENERATOR_ALLOWED)
 
 division = _Feature((2, 2, 0, "alpha", 2),
 (3, 0, 0, "alpha", 0),
! _new.CO_FUTURE_DIVISION)

AltStyle によって変換されたページ (->オリジナル) /