summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2019-09-10 14:31:26 (GMT)
committerGitHub <noreply@github.com>2019-09-10 14:31:26 (GMT)
commited99bb9ca68b37cfaec3629afa67d70289f3ffc7 (patch)
tree6d78ee273958e49223098616e3b783b43d237128 /Doc/reference
parent45bc3928e232603a97451dea3106d824b0f7a392 (diff)
downloadcpython-ed99bb9ca68b37cfaec3629afa67d70289f3ffc7.zip
cpython-ed99bb9ca68b37cfaec3629afa67d70289f3ffc7.tar.gz
cpython-ed99bb9ca68b37cfaec3629afa67d70289f3ffc7.tar.bz2
bpo-37913: document that __length_hint__ can return NotImplemented (GH-15383)
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/datamodel.rst4
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 8813f57..c6c6e40 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2155,7 +2155,9 @@ 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
+ The length must be an integer ``>=`` 0. The return value may also be
+ :const:`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