summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-06-01 21:05:48 (GMT)
committerGitHub <noreply@github.com>2019-06-01 21:05:48 (GMT)
commitbdbad71b9def0b86433de12cecca022eee91bd9f (patch)
tree147c8a3e08454a95e0e4900388d88f7b65430f63 /Doc/reference
parent1a4d9ffa1aecd7e750195f2be06d3d16c7a3a88f (diff)
downloadcpython-bdbad71b9def0b86433de12cecca022eee91bd9f.zip
cpython-bdbad71b9def0b86433de12cecca022eee91bd9f.tar.gz
cpython-bdbad71b9def0b86433de12cecca022eee91bd9f.tar.bz2
bpo-20092. Use __index__ in constructors of int, float and complex. (GH-13108)
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/datamodel.rst8
1 files changed, 3 insertions, 5 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 44017d8..fa47bf1 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2394,11 +2394,9 @@ left undefined.
functions). Presence of this method indicates that the numeric object is
an integer type. Must return an integer.
- .. note::
-
- In order to have a coherent integer type class, when :meth:`__index__` is
- defined :meth:`__int__` should also be defined, and both should return
- the same value.
+ If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not
+ defined then corresponding built-in functions :func:`int`, :func:`float`
+ and :func:`complex` fall back to :meth:`__index__`.
.. method:: object.__round__(self, [,ndigits])