[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
- Previous message: [Python-checkins] CVS: python/dist/src/Grammar Grammar,1.43,1.44
- Next message: [Python-checkins] CVS: python/dist/src/Include abstract.h,2.35,2.36 compile.h,2.33,2.34 object.h,2.82,2.83 opcode.h,2.36,2.37 pythonrun.h,2.44,2.45 token.h,2.18,2.19
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
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))
- Previous message: [Python-checkins] CVS: python/dist/src/Grammar Grammar,1.43,1.44
- Next message: [Python-checkins] CVS: python/dist/src/Include abstract.h,2.35,2.36 compile.h,2.33,2.34 object.h,2.82,2.83 opcode.h,2.36,2.37 pythonrun.h,2.44,2.45 token.h,2.18,2.19
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]