summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-02-21 02:55:49 (GMT)
committerGitHub <noreply@github.com>2021-02-21 02:55:49 (GMT)
commit7cc58890b3c16c28360a9abe030258426e89fec1 (patch)
treebf6139a2e0ec55670e81db835413e233b753b465
parent216cb1469f566ba5493bf53a73da9ccdac05ccfc (diff)
downloadcpython-7cc58890b3c16c28360a9abe030258426e89fec1.zip
cpython-7cc58890b3c16c28360a9abe030258426e89fec1.tar.gz
cpython-7cc58890b3c16c28360a9abe030258426e89fec1.tar.bz2
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 2f9ef514fb24b6a95bd3272885f197752810c107) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
-rw-r--r--Doc/reference/expressions.rst4
-rw-r--r--Misc/NEWS.d/next/Documentation/2021-02-20-00-09-13.bpo-27646.HRsmo-.rst2
2 files changed, 4 insertions, 2 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index 512aa5a..9b1a395 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -476,8 +476,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
index 0000000..8ba398a
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2021-02-20-00-09-13.bpo-27646.HRsmo-.rst
@@ -0,0 +1,2 @@
+Clarify that 'yield from <expr>' works with any iterable, not just
+iterators.