diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2012-01-14 04:47:41 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2012-01-14 04:47:41 (GMT) |
commit | 7cdb447b56974bb9e6c4b5fd4336d4c3a48d340c (patch) | |
tree | 51de20804f31e4ed6d0e685643a6005ca7f16ef7 | |
parent | ec6d7c89bedc53091e3ca078937156b092255117 (diff) | |
parent | 0ed8019c20b73f67397e53c710ddd076f0f384fd (diff) | |
download | cpython-7cdb447b56974bb9e6c4b5fd4336d4c3a48d340c.zip cpython-7cdb447b56974bb9e6c4b5fd4336d4c3a48d340c.tar.gz cpython-7cdb447b56974bb9e6c4b5fd4336d4c3a48d340c.tar.bz2 |
Merge
-rw-r--r-- | Doc/library/exceptions.rst | 3 | ||||
-rw-r--r-- | Doc/reference/expressions.rst | 5 | ||||
-rw-r--r-- | Doc/reference/simple_stmts.rst | 5 | ||||
-rw-r--r-- | Doc/whatsnew/3.3.rst | 1 |
4 files changed, 12 insertions, 2 deletions
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index a9a16d3..3f1a30d 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -261,6 +261,9 @@ The following exceptions are the exceptions that are usually raised. raised, and the value returned by the function is used as the :attr:`value` parameter to the constructor of the exception. + .. versionchanged:: 3.3 + Added ``value`` attribute and the ability for generator functions to + use it to return a value. .. exception:: SyntaxError diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 7da54a2..9746162 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -355,7 +355,7 @@ resumed before it is finalized (by reaching a zero reference count or by being garbage collected), the generator-iterator's :meth:`close` method will be called, allowing any pending :keyword:`finally` clauses to execute. -When ``yield from expression`` is used, it treats the supplied expression as +When ``yield from <expr>`` is used, it treats the supplied expression as a subiterator. All values produced by that subiterator are passed directly to the caller of the current generator's methods. Any values passed in with :meth:`send` and any exceptions passed in with :meth:`throw` are passed to @@ -369,6 +369,9 @@ the yield expression. It can be either set explicitly when raising :exc:`StopIteration`, or automatically when the sub-iterator is a generator (by returning a value from the sub-generator). + .. versionchanged:: 3.3 + Added ``yield from <expr>`` to delegate control flow to a subiterator + The parentheses can be omitted when the :keyword:`yield` expression is the sole expression on the right hand side of an assignment statement. diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst index d98b829..3bd0894 100644 --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -470,10 +470,13 @@ resumed before it is finalized (by reaching a zero reference count or by being garbage collected), the generator-iterator's :meth:`close` method will be called, allowing any pending :keyword:`finally` clauses to execute. -When ``yield from expression`` is used, it treats the supplied expression as +When ``yield from <expr>`` is used, it treats the supplied expression as a subiterator, producing values from it until the underlying iterator is exhausted. + .. versionchanged:: 3.3 + Added ``yield from <expr>`` to delegate control flow to a subiterator + For full details of :keyword:`yield` semantics, refer to the :ref:`yieldexpr` section. diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst index 07257f0..b2909f7 100644 --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -224,6 +224,7 @@ it provides better information about where they were actually defined, and how they might be accessible from the global scope. Example with (non-bound) methods:: + >>> class C: ... def meth(self): ... pass |