]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-27646: Say that 'yield from' expression can be any iterable (GH-24595)
authorTerry Jan Reedy <tjreedy@udel.edu>
Sun, 21 Feb 2021 02:33:25 +0000 (21:33 -0500)
committerGitHub <noreply@github.com>
Sun, 21 Feb 2021 02:33:25 +0000 (21:33 -0500)
Previously, the doc at least strongly implied that it had to be an iterator.

Doc/reference/expressions.rst
Misc/NEWS.d/next/Documentation/2021-02-20-00-09-13.bpo-27646.HRsmo-.rst [new file with mode: 0644]

index c8c9b4683e62d2e8bbfdeff9b98739cc57fa8e8d..17705b117c372b83089e568ae3ea97657a2243b3 100644 (file)
@@ -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
diff --git a/Misc/NEWS.d/next/Documentation/2021-02-20-00-09-13.bpo-27646.HRsmo-.rst b/Misc/NEWS.d/next/Documentation/2021-02-20-00-09-13.bpo-27646.HRsmo-.rst
new file mode 100644 (file)
index 0000000..8ba398a
--- /dev/null
@@ -0,0 +1,2 @@
+Clarify that 'yield from <expr>' works with any iterable, not just
+iterators.