summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorLisa Roach <lisaroach14@gmail.com>2018-09-14 06:56:23 (GMT)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2018-09-14 06:56:23 (GMT)
commit5ac704306f4b81ae3f28d8742408d3214b145e8a (patch)
tree34a39f0216d918b679367a84e05f2326aef70a7c /Doc
parent83df50ea5757816c7338d27f21fd18b1e79206f7 (diff)
downloadcpython-5ac704306f4b81ae3f28d8742408d3214b145e8a.zip
cpython-5ac704306f4b81ae3f28d8742408d3214b145e8a.tar.gz
cpython-5ac704306f4b81ae3f28d8742408d3214b145e8a.tar.bz2
bpo-33073: Adding as_integer_ratio to ints. (GH-8750)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/stdtypes.rst8
-rw-r--r--Doc/whatsnew/3.8.rst4
2 files changed, 12 insertions, 0 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index fd59a51..5a133e3 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -537,6 +537,14 @@ class`. In addition, it provides a few more methods:
.. versionadded:: 3.2
+.. method:: int.as_integer_ratio()
+
+ Return a pair of integers whose ratio is exactly equal to the original
+ integer and with a positive denominator. The integer ratio of integers
+ (whole numbers) is always the integer as the numerator and ``1`` as the
+ denominator.
+
+ .. versionadded:: 3.8
Additional Methods on Float
---------------------------
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index b2475c7..38b8623 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -91,6 +91,10 @@ Other Language Changes
was lifted.
(Contributed by Serhiy Storchaka in :issue:`32489`.)
+* The ``int`` type now has a new ``as_integer_ratio`` method compatible
+ with the existing ``float.as_integer_ratio`` method.
+ (Contributed by Lisa Roach in :issue:`33073`.)
+
* Added support of ``\N{name}`` escapes in :mod:`regular expressions <re>`.
(Contributed by Jonathan Eunice and Serhiy Storchaka in :issue:`30688`.)