Update numbers from Python 3.11

This commit is contained in:
DimitrisJim
2023-06-14 01:13:52 +03:00
parent 1df0a44958
commit c7d3358582
2 changed files with 8 additions and 6 deletions

12
Lib/numbers.py vendored
View File

@@ -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__ = ()