[Python-checkins] r60706 - peps/trunk/pep-3141.txt
guido.van.rossum
python-checkins at python.org
Sun Feb 10 02:14:47 CET 2008
Author: guido.van.rossum
Date: Sun Feb 10 02:14:46 2008
New Revision: 60706
Modified:
peps/trunk/pep-3141.txt
Log:
Explicitly acknowledge that Decimal will not become part of the numeric tower.
Modified: peps/trunk/pep-3141.txt
==============================================================================
--- peps/trunk/pep-3141.txt (original)
+++ peps/trunk/pep-3141.txt Sun Feb 10 02:14:46 2008
@@ -171,7 +171,7 @@
"""
# XXX What to do about the __int__ implementation that's
- # currently present on float and Decimal? Get rid of it?
+ # currently present on float? Get rid of it?
@abstractmethod
def __float__(self):
@@ -208,8 +208,7 @@
If ndigits is omitted or None, returns an Integral,
otherwise returns a Real, preferably of the same type as
self. Types may choose which direction to round half. For
- example, float rounds half toward even, and Decimal rounds
- it according to the current context.
+ example, float rounds half toward even.
"""
raise NotImplementedError
@@ -319,7 +318,7 @@
raise NotImplementedError
def __index__(self):
- """__index__() exists because float and Decimal have __int__()."""
+ """__index__() exists because float has __int__()."""
return int(self)
@abstractmethod
@@ -440,10 +439,9 @@
In 2.6, ``math.floor``, ``math.ceil``, and ``round`` will continue to
return floats.
-Because the ``int()`` conversion implemented by ``float`` (and by
-``decimal.Decimal``) is equivalent to but less explicit than
-``trunc()``, let's remove it. (Or, if that breaks too much, just add a
-deprecation warning.)
+The ``int()`` conversion implemented by ``float`` is equivalent to
+``trunc()``. In general, the ``int()`` conversion should try
+``__int__()`` first and if it is not found, try ``__trunc__()``.
``complex.__{divmod,mod,floordiv,int,float}__`` also go away. It would
be nice to provide a nice error message to help confused porters, but
@@ -554,6 +552,14 @@
more closely.
+The Decimal Type
+================
+
+After consultation with its authors it has been decided that the
+``Decimal`` type should not at this time be made part of the numeric
+tower.
+
+
References
==========
More information about the Python-checkins
mailing list