summaryrefslogtreecommitdiffstats
path: root/Lib/numbers.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-12-15 20:34:02 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-12-15 20:34:02 (GMT)
commitbfebb7b54a50f01104f7b6169de77f7fc8feb912 (patch)
treeef88caf96404fbb445d25a695eaa8e51bc750566 /Lib/numbers.py
parenta8ff01ca7422117dcd906ee2ea55c5293eeceb24 (diff)
downloadcpython-bfebb7b54a50f01104f7b6169de77f7fc8feb912.zip
cpython-bfebb7b54a50f01104f7b6169de77f7fc8feb912.tar.gz
cpython-bfebb7b54a50f01104f7b6169de77f7fc8feb912.tar.bz2
improve abstract property support (closes #11610)
Thanks to Darren Dale for patch.
Diffstat (limited to 'Lib/numbers.py')
-rw-r--r--Lib/numbers.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/numbers.py b/Lib/numbers.py
index ecfad7c..b206457 100644
--- a/Lib/numbers.py
+++ b/Lib/numbers.py
@@ -5,7 +5,7 @@
TODO: Fill out more detailed documentation on the operators."""
-from abc import ABCMeta, abstractmethod, abstractproperty
+from abc import ABCMeta, abstractmethod
__all__ = ["Number", "Complex", "Real", "Rational", "Integral"]
@@ -50,7 +50,8 @@ class Complex(Number):
"""True if self != 0. Called for bool(self)."""
return self != 0
- @abstractproperty
+ @property
+ @abstractmethod
def real(self):
"""Retrieve the real component of this number.
@@ -58,7 +59,8 @@ class Complex(Number):
"""
raise NotImplementedError
- @abstractproperty
+ @property
+ @abstractmethod
def imag(self):
"""Retrieve the imaginary component of this number.
@@ -272,11 +274,13 @@ class Rational(Real):
__slots__ = ()
- @abstractproperty
+ @property
+ @abstractmethod
def numerator(self):
raise NotImplementedError
- @abstractproperty
+ @property
+ @abstractmethod
def denominator(self):
raise NotImplementedError