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.
(cherry picked from commit 2f9ef514fb)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
Miss Islington (bot) 2021-02-20 18:55:49 -08:00 committed by GitHub
parent 216cb1469f
commit 7cc58890b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -476,8 +476,8 @@ allowing any pending :keyword:`finally` clauses to execute.
.. index:: .. index::
single: from; yield from expression single: from; yield from expression
When ``yield from <expr>`` is used, it treats the supplied expression as When ``yield from <expr>`` is used, the supplied expression must be an
a subiterator. All values produced by that subiterator are passed directly 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 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.send` and any exceptions passed in with
:meth:`~generator.throw` are passed to the underlying iterator if it has the :meth:`~generator.throw` are passed to the underlying iterator if it has the

View file

@ -0,0 +1,2 @@
Clarify that 'yield from <expr>' works with any iterable, not just
iterators.