Clarify what happens on g.throw(StopIteration).
This commit is contained in:
parent
70ca01847a
commit
67adddea25
|
@ -72,6 +72,12 @@ again. The answer is that it from this point on it will raise
|
|||
``StopIteration`` -- the behavior is the same as when any other
|
||||
exception was raised by the generator.
|
||||
|
||||
Another logical consequence of the proposal: if somone uses
|
||||
``g.throw(StopIteration)`` to throw a ``StopIteration`` exception into
|
||||
a generator, if the generator doesn't catch it (which it could do
|
||||
using a ``try/except`` around the ``yield``), it will be transformed
|
||||
into ``RuntimeError``.
|
||||
|
||||
|
||||
Consequences for existing code
|
||||
==============================
|
||||
|
|
Loading…
Reference in New Issue