Updates from Christopher Craig.
This commit is contained in:
parent
f6e3df20d0
commit
3719ffd32e
15
pep-0240.txt
15
pep-0240.txt
|
@ -41,16 +41,17 @@ Backwards Compatibility
|
|||
The only backwards compatible issue is the type of literals
|
||||
mentioned above. The following migration is suggested:
|
||||
|
||||
1. "from __future__ import rational_literals" will cause all such
|
||||
literals to be treated as rational numbers.
|
||||
1. The next Python after approval will allow
|
||||
"from __future__ import rational_literals"
|
||||
to cause all such literals to be treated as rational numbers.
|
||||
|
||||
2. Python 2.2 will have a warning, turned off by default, about
|
||||
2. Python 3.0 will have a warning, turned on by default, about
|
||||
such literals in the absence of a __future__ statement. The
|
||||
warning message will contain information about the __future__
|
||||
statement, and indicate that to get floating point literals,
|
||||
they should be suffixed with "e0".
|
||||
|
||||
3. Python 2.3 will have the warning turned on by default. This
|
||||
3. Python 3.1 will have the warning turned off by default. This
|
||||
warning will stay in place for 24 months, at which time the
|
||||
literals will be rationals and the warning will be removed.
|
||||
|
||||
|
@ -61,6 +62,12 @@ Common Objections
|
|||
(Relax, I'm not taking floats away, I'm just adding two more characters.
|
||||
1e0 will still be a float)
|
||||
|
||||
Rationals must present themselves as a decimal float or they will be
|
||||
horrible for users expecting decimals (i.e. str(.5) should return '.5' and
|
||||
not '1/2'). This means that many rationals must be truncated at some
|
||||
point, which gives us a new loss of precision.
|
||||
|
||||
|
||||
|
||||
References
|
||||
|
||||
|
|
Loading…
Reference in New Issue