Optional arguments for throw() to match raise syntax

This commit is contained in:
Raymond Hettinger 2005-06-17 21:58:59 +00:00
parent 22cb64a602
commit 461d444be3
1 changed files with 5 additions and 5 deletions

View File

@ -167,10 +167,10 @@ Motivation and Summary
log it; the generator is not allowed to yield another value, since
the with-statement should not be usable as a loop (raising a
different exception is marginally acceptable). To enable this, a
new throw() method for generators is proposed, which takes three
arguments representing an exception in the usual fashion (type,
value, traceback) and raises it at the point where the generator
is suspended.
new throw() method for generators is proposed, which takes one to
three arguments representing an exception in the usual fashion
(type, value, traceback) and raises it at the point where the
generator is suspended.
Once we have this, it is a small step to proposing another
generator method, close(), which calls throw() with a special
@ -273,7 +273,7 @@ Specification: Generator Enhancements
The syntax for generator functions is extended to allow a
yield-statement inside a try-finally statement.
New generator method: throw(type, value, traceback)
New generator method: throw(type, value=None, traceback=None)
g.throw(type, value, traceback) causes the specified exception to
be thrown at the point where the generator g is currently