diff options
author | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-01-05 08:47:13 (GMT) |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-01-05 08:47:13 (GMT) |
commit | 9871d8fe22566acf68bf336d04d3a1dbd51f3269 (patch) | |
tree | 89540b4ff5f893e36c916534be2f07b5a7166fc1 /Lib/numbers.py | |
parent | f7476c4d463b5770b98d980bcd9bff3db981445d (diff) | |
download | cpython-9871d8fe22566acf68bf336d04d3a1dbd51f3269.zip cpython-9871d8fe22566acf68bf336d04d3a1dbd51f3269.tar.gz cpython-9871d8fe22566acf68bf336d04d3a1dbd51f3269.tar.bz2 |
Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
* Revert round to its 2.6 behavior (half away from 0).
* Because round, floor, and ceil always return float again, it's no
longer necessary to have them delegate to __xxx___, so I've ripped
that out of their implementations and the Real ABC. This also helps
in implementing types that work in both 2.6 and 3.0: you return int
from the __xxx__ methods, and let it get enabled by the version
upgrade.
* Make pow(-1, .5) raise a ValueError again.
Diffstat (limited to 'Lib/numbers.py')
-rw-r--r-- | Lib/numbers.py | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/Lib/numbers.py b/Lib/numbers.py index d23fa34..3c13290 100644 --- a/Lib/numbers.py +++ b/Lib/numbers.py @@ -189,25 +189,6 @@ class Real(Complex): """ raise NotImplementedError - @abstractmethod - def __floor__(self): - """Finds the greatest Integral <= self.""" - raise NotImplementedError - - @abstractmethod - def __ceil__(self): - """Finds the least Integral >= self.""" - raise NotImplementedError - - @abstractmethod - def __round__(self, ndigits=None): - """Rounds self to ndigits decimal places, defaulting to 0. - - If ndigits is omitted or None, returns an Integral, otherwise - returns a Real. Rounds half toward even. - """ - raise NotImplementedError - def __divmod__(self, other): """divmod(self, other): The pair (self // other, self % other). |