summaryrefslogtreecommitdiffstats
path: root/Doc/library/functions.rst
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-09-22 21:47:24 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-09-22 21:47:24 (GMT)
commit3e124ae739db8dc6ad43687d6b14466a572a6f8e (patch)
treec3923f748294a32af0b47a455ff91391c3dffd54 /Doc/library/functions.rst
parent2df811362213d9e987193772d3bf835a204f2727 (diff)
downloadcpython-3e124ae739db8dc6ad43687d6b14466a572a6f8e.zip
cpython-3e124ae739db8dc6ad43687d6b14466a572a6f8e.tar.gz
cpython-3e124ae739db8dc6ad43687d6b14466a572a6f8e.tar.bz2
Issue #1766304: Optimize membership testing for ranges: 'n in range(...)'
does an O(1) check, if n is an integer. Non-integers aren't affected. Thanks Robert Lehmann.
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r--Doc/library/functions.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 198ff7b..ef021dd 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -925,6 +925,10 @@ are always available. They are listed here in alphabetical order.
>>> list(range(1, 0))
[]
+ .. versionchanged:: 3.2
+ Testing integers for membership takes constant time instead of
+ iterating through all items.
+
.. function:: repr(object)