File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
5959done to start the coroutine. Just like ``generators `` coroutines do not
6060start 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
6464We can close a coroutine by calling the ``.close() `` method. Like:
6565
You can’t perform that action at this time.
0 commit comments