Skip to content

Commit b1aef5c

Browse files
committed
- Firm up commentary on yield from in corotuines.
1 parent a5fdd0e commit b1aef5c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Doc/howto/a-conceptual-overview-of-asyncio.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,15 @@ The only way to yield (or effectively cede control) from a coroutine is to
296296
That might sound odd to you. Frankly, it was to me too. You might be thinking:
297297

298298
1. What about a ``yield`` directly within the coroutine? The coroutine becomes
299-
a generator-coroutine, a different beast entirely.
299+
a generator-coroutine (or async generator), a different beast entirely.
300300

301301
2. What about a ``yield from`` within the coroutine to a function that yields
302302
(that is, plain generator)?
303303
``SyntaxError: yield from not allowed in a coroutine.``
304-
I imagine Python made this a ``SyntaxError`` to mandate only one way of using
305-
coroutines for the sake of simplicity.
306-
Ideologically, ``yield from`` and ``await`` are quite similar.
304+
This was intentionally designed for the sake of simplicity -- mandating only
305+
one way of using coroutines. Originally ``yield`` was actually barred as well,
306+
but was re-accepted to allow for async generators.
307+
Ideologically, ``yield from`` and ``await`` are very similar.
307308

308309
=======
309310
Futures

0 commit comments

Comments
 (0)