Skip to content

Commit 3bdddad

Browse files
committed
Merge pull request yasoob#53 from cldershem/fixNext
`.next()` has been deprecated in Python 3.
2 parents 7b9a3d8 + 4d7d7a3 commit 3bdddad

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

coroutines.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ Here is an example:
4848
.. code:: python
4949
5050
search = grep('coroutine')
51-
search.next()
51+
next(search)
5252
# Output: Searching for coroutine
5353
search.send("I love you")
5454
search.send("Don't you love me?")
5555
search.send("I love coroutines instead!")
5656
# Output: I love coroutines instead!
5757
58-
The sent values are accessed by yield. Why did we run ``.next()``? It is
58+
The sent values are accessed by yield. Why did we run ``next()``? It is
5959
done to start the coroutine. Just like ``generators`` coroutines do not
6060
start the function immediately. Instead they run it in response to
61-
``.next()`` and ``.send()`` methods. Therefore you have to run
62-
``.next()`` so that the execution advances to the ``yield`` expression.
61+
``__next__()`` and ``.send()`` methods. Therefore you have to run
62+
``next()`` so that the execution advances to the ``yield`` expression.
6363

6464
We can close a coroutine by calling the ``.close()`` method. Like:
6565

0 commit comments

Comments
 (0)