diff options
Diffstat (limited to 'Lib/numbers.py')
-rw-r--r-- | Lib/numbers.py | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/Lib/numbers.py b/Lib/numbers.py index 0634f62ff1..ed815ef41e 100644 --- a/Lib/numbers.py +++ b/Lib/numbers.py @@ -148,7 +148,7 @@ class Real(Complex): """To Complex, Real adds the operations that work on real numbers. In short, those are: a conversion to float, trunc(), divmod, - is_integer, %, <, <=, >, and >=. + %, <, <=, >, and >=. Real also provides defaults for the derived operations. """ @@ -242,17 +242,6 @@ class Real(Complex): """self <= other""" raise NotImplementedError - def is_integer(self): - """Return True if the Real is integral; otherwise return False. - - This default implementation can be overridden in subclasses - for performance reasons or to deal with values such as NaN, - which would otherwise cause an exception to be raised. - """ - # Although __int__ is not defined at this level, the int - # constructor falls back to __trunc__, which we do have. - return self == int(self) - # Concrete implementations of Complex abstract methods. def __complex__(self): """complex(self) == complex(float(self), 0)""" @@ -301,10 +290,6 @@ class Rational(Real): """ return self.numerator / self.denominator - def is_integer(self): - """Return True if the Rational is integral; otherwise return False.""" - return self.denominator == 1 - class Integral(Rational): """Integral adds a conversion to int and the bit-string operations.""" @@ -401,8 +386,4 @@ class Integral(Rational): """Integers have a denominator of 1.""" return 1 - def is_integer(self): - """Return True; all Integrals represent an integral value.""" - return True - Integral.register(int) |