Skip to content

Commit

Permalink
bpo-27646: Say that 'yield from' expression can be any iterable (GH-2…
Browse files Browse the repository at this point in the history
…4595)

Previously, the doc at least strongly implied that it had to be an iterator.
  • Loading branch information
terryjreedy committed Feb 21, 2021
1 parent bf838a6 commit 2f9ef51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Doc/reference/expressions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ allowing any pending :keyword:`finally` clauses to execute.
.. index::
single: from; yield from expression

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

0 comments on commit 2f9ef51

Please sign in to comment.