Skip to content

Commit 2f9ef51

Browse files
authored
bpo-27646: Say that 'yield from' expression can be any iterable (GH-24595)
Previously, the doc at least strongly implied that it had to be an iterator.
1 parent bf838a6 commit 2f9ef51

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Doc/reference/expressions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,8 @@ allowing any pending :keyword:`finally` clauses to execute.
478478
.. index::
479479
single: from; yield from expression
480480

481-
When ``yield from <expr>`` is used, it treats the supplied expression as
482-
a subiterator. All values produced by that subiterator are passed directly
481+
When ``yield from <expr>`` is used, the supplied expression must be an
482+
iterable. The values produced by iterating that iterable are passed directly
483483
to the caller of the current generator's methods. Any values passed in with
484484
:meth:`~generator.send` and any exceptions passed in with
485485
:meth:`~generator.throw` are passed to the underlying iterator if it has the
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Clarify that 'yield from <expr>' works with any iterable, not just
2+
iterators.

0 commit comments

Comments
 (0)