summaryrefslogtreecommitdiffstats
path: root/Lib/numbers.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-02-12 17:58:36 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-02-12 17:58:36 (GMT)
commitc28ad27dbb7e79486691c814d0c31b8da7ad2602 (patch)
tree3abd985279ffc0076e4d1bbd9367ab245a052c22 /Lib/numbers.py
parentbc448664af5add9f76400c1a8aee0e4324bc609b (diff)
downloadcpython-c28ad27dbb7e79486691c814d0c31b8da7ad2602.zip
cpython-c28ad27dbb7e79486691c814d0c31b8da7ad2602.tar.gz
cpython-c28ad27dbb7e79486691c814d0c31b8da7ad2602.tar.bz2
Issue 4998: restore utility of __slots__ on Fraction.
(forward merge of r68813).
Diffstat (limited to 'Lib/numbers.py')
-rw-r--r--Lib/numbers.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/numbers.py b/Lib/numbers.py
index 827c253..82960f0 100644
--- a/Lib/numbers.py
+++ b/Lib/numbers.py
@@ -15,6 +15,8 @@ class Number(metaclass=ABCMeta):
If you just want to check if an argument x is a number, without
caring what kind, use isinstance(x, Number).
"""
+ __slots__ = ()
+
# Concrete numeric types must provide their own hash implementation
__hash__ = None
@@ -38,6 +40,8 @@ class Complex(Number):
type as described below.
"""
+ __slots__ = ()
+
@abstractmethod
def __complex__(self):
"""Return a builtin complex instance. Called for complex(self)."""
@@ -152,6 +156,8 @@ class Real(Complex):
Real also provides defaults for the derived operations.
"""
+ __slots__ = ()
+
@abstractmethod
def __float__(self):
"""Any Real can be converted to a native float object.
@@ -264,6 +270,8 @@ Real.register(float)
class Rational(Real):
""".numerator and .denominator should be in lowest terms."""
+ __slots__ = ()
+
@abstractproperty
def numerator(self):
raise NotImplementedError
@@ -287,6 +295,8 @@ class Rational(Real):
class Integral(Rational):
"""Integral adds a conversion to int and the bit-string operations."""
+ __slots__ = ()
+
@abstractmethod
def __int__(self):
"""int(self)"""