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

Guido van Rossum gvanrossum@users.sourceforge.net
2001年8月07日 22:00:20 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv23513/Lib
Modified Files:
	__future__.py 
Log Message:
Implement PEP 238 in its (almost) full glory.
This introduces:
- A new operator // that means floor division (the kind of division
 where 1/2 is 0).
- The "future division" statement ("from __future__ import division)
 which changes the meaning of the / operator to implement "true
 division" (where 1/2 is 0.5).
- New overloadable operators __truediv__ and __floordiv__.
- New slots in the PyNumberMethods struct for true and floor division,
 new abstract APIs for them, new opcodes, and so on.
I emphasize that without the future division statement, the semantics
of / will remain unchanged until Python 3.0.
Not yet implemented are warnings (default off) when / is used with int
or long arguments.
This has been on display since 7/31 as SF patch #443474.
Flames to /dev/null.
Index: __future__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/__future__.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** __future__.py	2001年07月15日 21:08:29	1.7
--- __future__.py	2001年08月08日 05:00:17	1.8
***************
*** 69,70 ****
--- 69,71 ----
 nested_scopes = _Feature((2, 1, 0, "beta", 1), (2, 2, 0, "alpha", 0))
 generators = _Feature((2, 2, 0, "alpha", 1), (2, 3, 0, "final", 0))
+ division = _Feature((2, 2, 0, "alpha", 2), (3, 0, 0, "alpha", 0))

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