mirror of
https://github.com/python/cpython.git
synced 2025-08-15 22:30:42 +00:00
Merged revisions 68813,69546 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r68813 | raymond.hettinger | 2009-01-20 20:34:19 +0000 (Tue, 20 Jan 2009) | 3 lines Issue 4998: __slots__ on Fractions was useless. ........ r69546 | mark.dickinson | 2009-02-12 17:55:42 +0000 (Thu, 12 Feb 2009) | 2 lines Typo fix. ........
This commit is contained in:
parent
293afb8cc9
commit
a84f265c36
3 changed files with 18 additions and 0 deletions
|
@ -17,6 +17,7 @@ class Number(object):
|
|||
caring what kind, use isinstance(x, Number).
|
||||
"""
|
||||
__metaclass__ = ABCMeta
|
||||
__slots__ = ()
|
||||
|
||||
# Concrete numeric types must provide their own hash implementation
|
||||
__hash__ = None
|
||||
|
@ -41,6 +42,8 @@ class Complex(Number):
|
|||
type as described below.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
@abstractmethod
|
||||
def __complex__(self):
|
||||
"""Return a builtin complex instance. Called for complex(self)."""
|
||||
|
@ -172,6 +175,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.
|
||||
|
@ -265,6 +270,8 @@ Real.register(float)
|
|||
class Rational(Real):
|
||||
""".numerator and .denominator should be in lowest terms."""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
@abstractproperty
|
||||
def numerator(self):
|
||||
raise NotImplementedError
|
||||
|
@ -288,6 +295,8 @@ class Rational(Real):
|
|||
class Integral(Rational):
|
||||
"""Integral adds a conversion to long and the bit-string operations."""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
@abstractmethod
|
||||
def __long__(self):
|
||||
"""long(self)"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue