summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/concurrent.futures.rst22
-rw-r--r--Doc/library/dis.rst8
-rw-r--r--Doc/library/exceptions.rst2
-rw-r--r--Doc/library/functions.rst21
-rw-r--r--Doc/library/stdtypes.rst9
5 files changed, 33 insertions, 29 deletions
diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst
index 29ffc0d..eee2285 100644
--- a/Doc/library/concurrent.futures.rst
+++ b/Doc/library/concurrent.futures.rst
@@ -42,12 +42,13 @@ Executor Objects
Equivalent to ``map(func, *iterables)`` except *func* is executed
asynchronously and several calls to *func* may be made concurrently. The
- returned iterator raises a :exc:`TimeoutError` if :meth:`__next__()` is
- called and the result isn't available after *timeout* seconds from the
- original call to :meth:`Executor.map`. *timeout* can be an int or a
- float. If *timeout* is not specified or ``None``, there is no limit to
- the wait time. If a call raises an exception, then that exception will
- be raised when its value is retrieved from the iterator.
+ returned iterator raises a :exc:`TimeoutError` if
+ :meth:`~iterator.__next__` is called and the result isn't available
+ after *timeout* seconds from the original call to :meth:`Executor.map`.
+ *timeout* can be an int or a float. If *timeout* is not specified or
+ ``None``, there is no limit to the wait time. If a call raises an
+ exception, then that exception will be raised when its value is
+ retrieved from the iterator.
.. method:: shutdown(wait=True)
@@ -358,10 +359,11 @@ Module Functions
different :class:`Executor` instances) given by *fs* that yields futures as
they complete (finished or were cancelled). Any futures that completed
before :func:`as_completed` is called will be yielded first. The returned
- iterator raises a :exc:`TimeoutError` if :meth:`__next__` is called and the
- result isn't available after *timeout* seconds from the original call to
- :func:`as_completed`. *timeout* can be an int or float. If *timeout* is not
- specified or ``None``, there is no limit to the wait time.
+ iterator raises a :exc:`TimeoutError` if :meth:`~iterator.__next__` is
+ called and the result isn't available after *timeout* seconds from the
+ original call to :func:`as_completed`. *timeout* can be an int or float.
+ If *timeout* is not specified or ``None``, there is no limit to the wait
+ time.
.. seealso::
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 79cc583..108cda7 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -658,10 +658,10 @@ the more significant byte last.
.. opcode:: FOR_ITER (delta)
- ``TOS`` is an :term:`iterator`. Call its :meth:`__next__` method. If this
- yields a new value, push it on the stack (leaving the iterator below it). If
- the iterator indicates it is exhausted ``TOS`` is popped, and the byte code
- counter is incremented by *delta*.
+ ``TOS`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` method.
+ If this yields a new value, push it on the stack (leaving the iterator below
+ it). If the iterator indicates it is exhausted ``TOS`` is popped, and the
+ byte code counter is incremented by *delta*.
.. opcode:: LOAD_GLOBAL (namei)
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst
index ca3ad3e..7d622c2 100644
--- a/Doc/library/exceptions.rst
+++ b/Doc/library/exceptions.rst
@@ -262,7 +262,7 @@ The following exceptions are the exceptions that are usually raised.
.. exception:: StopIteration
Raised by built-in function :func:`next` and an :term:`iterator`\'s
- :meth:`__next__` method to signal that there are no further values.
+ :meth:`~iterator.__next__` method to signal that there are no further values.
.. exception:: SyntaxError
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 2575d7f..572706a 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -346,10 +346,10 @@ are always available. They are listed here in alphabetical order.
.. function:: enumerate(iterable, start=0)
Return an enumerate object. *iterable* must be a sequence, an
- :term:`iterator`, or some other object which supports iteration. The
- :meth:`__next__` method of the iterator returned by :func:`enumerate` returns a
- tuple containing a count (from *start* which defaults to 0) and the
- values obtained from iterating over *iterable*.
+ :term:`iterator`, or some other object which supports iteration.
+ The :meth:`~iterator.__next__` method of the iterator returned by
+ :func:`enumerate` returns a tuple containing a count (from *start* which
+ defaults to 0) and the values obtained from iterating over *iterable*.
>>> seasons = ['Spring', 'Summer', 'Fall', 'Winter']
>>> list(enumerate(seasons))
@@ -681,9 +681,10 @@ are always available. They are listed here in alphabetical order.
starting at ``0``). If it does not support either of those protocols,
:exc:`TypeError` is raised. If the second argument, *sentinel*, is given,
then *object* must be a callable object. The iterator created in this case
- will call *object* with no arguments for each call to its :meth:`__next__`
- method; if the value returned is equal to *sentinel*, :exc:`StopIteration`
- will be raised, otherwise the value will be returned.
+ will call *object* with no arguments for each call to its
+ :meth:`~iterator.__next__` method; if the value returned is equal to
+ *sentinel*, :exc:`StopIteration` will be raised, otherwise the value will
+ be returned.
One useful application of the second form of :func:`iter` is to read lines of
a file until a certain line is reached. The following example reads a file
@@ -781,9 +782,9 @@ are always available. They are listed here in alphabetical order.
.. function:: next(iterator[, default])
- Retrieve the next item from the *iterator* by calling its :meth:`__next__`
- method. If *default* is given, it is returned if the iterator is exhausted,
- otherwise :exc:`StopIteration` is raised.
+ Retrieve the next item from the *iterator* by calling its
+ :meth:`~iterator.__next__` method. If *default* is given, it is returned
+ if the iterator is exhausted, otherwise :exc:`StopIteration` is raised.
.. function:: object()
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 9688393..7d47ec7 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -775,9 +775,9 @@ specific sequence types, dictionaries, and other more specialized forms. The
specific types are not important beyond their implementation of the iterator
protocol.
-Once an iterator's :meth:`__next__` method raises :exc:`StopIteration`, it must
-continue to do so on subsequent calls. Implementations that do not obey this
-property are deemed broken.
+Once an iterator's :meth:`~iterator.__next__` method raises
+:exc:`StopIteration`, it must continue to do so on subsequent calls.
+Implementations that do not obey this property are deemed broken.
.. _generator-types:
@@ -788,7 +788,8 @@ Generator Types
Python's :term:`generator`\s provide a convenient way to implement the iterator
protocol. If a container object's :meth:`__iter__` method is implemented as a
generator, it will automatically return an iterator object (technically, a
-generator object) supplying the :meth:`__iter__` and :meth:`__next__` methods.
+generator object) supplying the :meth:`__iter__` and :meth:`~generator.__next__`
+methods.
More information about generators can be found in :ref:`the documentation for
the yield expression <yieldexpr>`.