summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen Demeyer <J.Demeyer@UGent.be>2019-09-10 14:01:13 (GMT)
committerSteve Dower <steve.dower@python.org>2019-09-10 14:01:13 (GMT)
commit009ef2955d91e04f62a7159a1c7ddaddbfedc3b6 (patch)
treea52b3f51141110fa2ca7a8f1ec2f8ee745f54d25
parent17499d82702432955d8e442a1871ff276ca64bc5 (diff)
downloadcpython-009ef2955d91e04f62a7159a1c7ddaddbfedc3b6.zip
cpython-009ef2955d91e04f62a7159a1c7ddaddbfedc3b6.tar.gz
cpython-009ef2955d91e04f62a7159a1c7ddaddbfedc3b6.tar.bz2
bpo-37913: document that __length_hint__ can return NotImplemented (GH-15383)
-rw-r--r--Doc/reference/datamodel.rst6
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 8813f57..6b9325d 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2155,8 +2155,10 @@ through the container; for mappings, :meth:`__iter__` should be the same as
Called to implement :func:`operator.length_hint`. Should return an estimated
length for the object (which may be greater or less than the actual length).
- The length must be an integer ``>=`` 0. This method is purely an
- optimization and is never required for correctness.
+ The length must be an integer ``>=`` 0. The return value may also be
+ *NotImplemented*, which is treated the same as if the ``__length_hint__``
+ method didn't exist at all. This method is purely an optimization and is
+ never required for correctness.
.. versionadded:: 3.4