forked from Rust-related/RustPython
Update numbers from Python 3.11
This commit is contained in:
12
Lib/numbers.py
vendored
12
Lib/numbers.py
vendored
@@ -33,9 +33,9 @@ class Complex(Number):
|
||||
"""Complex defines the operations that work on the builtin complex type.
|
||||
|
||||
In short, those are: a conversion to complex, .real, .imag, +, -,
|
||||
*, /, abs(), .conjugate, ==, and !=.
|
||||
*, /, **, abs(), .conjugate, ==, and !=.
|
||||
|
||||
If it is given heterogenous arguments, and doesn't have special
|
||||
If it is given heterogeneous arguments, and doesn't have special
|
||||
knowledge about them, it should fall back to the builtin complex
|
||||
type as described below.
|
||||
"""
|
||||
@@ -288,11 +288,15 @@ class Rational(Real):
|
||||
so that ratios of huge integers convert without overflowing.
|
||||
|
||||
"""
|
||||
return self.numerator / self.denominator
|
||||
return int(self.numerator) / int(self.denominator)
|
||||
|
||||
|
||||
class Integral(Rational):
|
||||
"""Integral adds a conversion to int and the bit-string operations."""
|
||||
"""Integral adds methods that work on integral numbers.
|
||||
|
||||
In short, these are conversion to int, pow with modulus, and the
|
||||
bit-string operations.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user