summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorPaul Dagnelie <paulcd2000@gmail.com>2019-05-22 14:23:01 (GMT)
committerIvan Levkivskyi <levkivskyi@gmail.com>2019-05-22 14:23:01 (GMT)
commit4c7a46eb3c009c85ddf2eb315d94d804745187d4 (patch)
treeb6ffaec1dab471a445b59b6ab7d127afc347ac33 /Doc
parent33e71e01e95506cf8d93fd68251fc56352bc7b39 (diff)
downloadcpython-4c7a46eb3c009c85ddf2eb315d94d804745187d4.zip
cpython-4c7a46eb3c009c85ddf2eb315d94d804745187d4.tar.gz
cpython-4c7a46eb3c009c85ddf2eb315d94d804745187d4.tar.bz2
bpo-36972: Add SupportsIndex (GH-13448)
In order to support typing checks calling hex(), oct() and bin() on user-defined classes, a SupportIndex protocol is required. The ability to check these at runtime would be good to add for completeness sake. This is pretty much just a copy of SupportsInt with the names tweaked.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/typing.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index c2523ed..86a3db8 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -529,6 +529,12 @@ The module defines the following classes, functions and decorators:
An ABC with one abstract method ``__bytes__``.
+.. class:: SupportsIndex
+
+ An ABC with one abstract method ``__index__``.
+
+ .. versionadded:: 3.8
+
.. class:: SupportsAbs
An ABC with one abstract method ``__abs__`` that is covariant