Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cdb447

Browse files
committed
Merge
2 parents ec6d7c8 + 0ed8019 commit 7cdb447

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

Doc/library/exceptions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ The following exceptions are the exceptions that are usually raised.
261261
raised, and the value returned by the function is used as the
262262
:attr:`value` parameter to the constructor of the exception.
263263

264+
.. versionchanged:: 3.3
265+
Added ``value`` attribute and the ability for generator functions to
266+
use it to return a value.
264267

265268
.. exception:: SyntaxError
266269

Doc/reference/expressions.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ resumed before it is finalized (by reaching a zero reference count or by being
355355
garbage collected), the generator-iterator's :meth:`close` method will be
356356
called, allowing any pending :keyword:`finally` clauses to execute.
357357

358-
When ``yield from expression`` is used, it treats the supplied expression as
358+
When ``yield from <expr>`` is used, it treats the supplied expression as
359359
a subiterator. All values produced by that subiterator are passed directly
360360
to the caller of the current generator's methods. Any values passed in with
361361
: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
369369
:exc:`StopIteration`, or automatically when the sub-iterator is a generator
370370
(by returning a value from the sub-generator).
371371

372+
.. versionchanged:: 3.3
373+
Added ``yield from <expr>`` to delegate control flow to a subiterator
374+
372375
The parentheses can be omitted when the :keyword:`yield` expression is the
373376
sole expression on the right hand side of an assignment statement.
374377

Doc/reference/simple_stmts.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,13 @@ resumed before it is finalized (by reaching a zero reference count or by being
470470
garbage collected), the generator-iterator's :meth:`close` method will be
471471
called, allowing any pending :keyword:`finally` clauses to execute.
472472

473-
When ``yield from expression`` is used, it treats the supplied expression as
473+
When ``yield from <expr>`` is used, it treats the supplied expression as
474474
a subiterator, producing values from it until the underlying iterator is
475475
exhausted.
476476

477+
.. versionchanged:: 3.3
478+
Added ``yield from <expr>`` to delegate control flow to a subiterator
479+
477480
For full details of :keyword:`yield` semantics, refer to the :ref:`yieldexpr`
478481
section.
479482

Doc/whatsnew/3.3.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ it provides better information about where they were actually defined, and
224224
how they might be accessible from the global scope.
225225

226226
Example with (non-bound) methods::
227+
227228
>>> class C:
228229
... def meth(self):
229230
... pass

0 commit comments

Comments
 (0)