diff options
author | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-01-17 07:36:30 (GMT) |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-01-17 07:36:30 (GMT) |
commit | 9893de1b83978249eafaebe575989537c01b484e (patch) | |
tree | 25f465a8eba333743569badfb2783e13c8a8b2f8 /Lib/numbers.py | |
parent | 35641461db7c692877ffa4bbbfe31a525c81770e (diff) | |
download | cpython-9893de1b83978249eafaebe575989537c01b484e.zip cpython-9893de1b83978249eafaebe575989537c01b484e.tar.gz cpython-9893de1b83978249eafaebe575989537c01b484e.tar.bz2 |
Update the py3k version of the rational module to expose only methods needed by
py3k (i.e., no __div__) and use py3k functions like math.floor().
Diffstat (limited to 'Lib/numbers.py')
-rw-r--r-- | Lib/numbers.py | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/Lib/numbers.py b/Lib/numbers.py index 7c73fa7..6c3c3e1 100644 --- a/Lib/numbers.py +++ b/Lib/numbers.py @@ -5,7 +5,6 @@ TODO: Fill out more detailed documentation on the operators.""" -from __future__ import division from abc import ABCMeta, abstractmethod, abstractproperty __all__ = ["Number", "Exact", "Inexact", @@ -62,8 +61,7 @@ class Complex(Number): def __complex__(self): """Return a builtin complex instance. Called for complex(self).""" - # Will be __bool__ in 3.0. - def __nonzero__(self): + def __bool__(self): """True if self != 0. Called for bool(self).""" return self != 0 @@ -122,29 +120,13 @@ class Complex(Number): raise NotImplementedError @abstractmethod - def __div__(self, other): - """self / other without __future__ division - - May promote to float. - """ - raise NotImplementedError - - @abstractmethod - def __rdiv__(self, other): - """other / self without __future__ division""" - raise NotImplementedError - - @abstractmethod def __truediv__(self, other): - """self / other with __future__ division. - - Should promote to float when necessary. - """ + """self / other: Should promote to float when necessary.""" raise NotImplementedError @abstractmethod def __rtruediv__(self, other): - """other / self with __future__ division""" + """other / self""" raise NotImplementedError @abstractmethod |