From: Sandro Tosi Date: Wed, 15 Aug 2012 19:37:35 +0000 (+0200) Subject: clarify in/not in in case of infinite iterators; thanks to Sergey Skovorodkin from... X-Git-Tag: v3.3.0rc1~103^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dd7c55250d67de4d430a0c51dba4f3c0cd8f6ed3;p=thirdparty%2FPython%2Fcpython.git clarify in/not in in case of infinite iterators; thanks to Sergey Skovorodkin from docs@ --- diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst index 8934d5e7f41e..f1ed07b44cea 100644 --- a/Doc/howto/functional.rst +++ b/Doc/howto/functional.rst @@ -246,9 +246,9 @@ Built-in functions such as :func:`max` and :func:`min` can take a single iterator argument and will return the largest or smallest element. The ``"in"`` and ``"not in"`` operators also support iterators: ``X in iterator`` is true if X is found in the stream returned by the iterator. You'll run into obvious -problems if the iterator is infinite; ``max()``, ``min()``, and ``"not in"`` +problems if the iterator is infinite; ``max()``, ``min()`` will never return, and if the element X never appears in the stream, the -``"in"`` operator won't return either. +``"in"`` and ``"not in"`` operators won't return either. Note that you can only go forward in an iterator; there's no way to get the previous element, reset the iterator, or make a copy of it. Iterator objects