Simplify the proposal for gen.throw().
This commit is contained in:
parent
9198b9cf32
commit
f868ba34f0
15
pep-0288.txt
15
pep-0288.txt
|
@ -119,17 +119,12 @@ Specification for Generator Exception Passing:
|
|||
genraise(), raiseinto(), and flush(). None of these fit as well
|
||||
as throw().
|
||||
|
||||
Note B: The full throw() syntax should exactly match raise's syntax:
|
||||
Note B: To keep the throw() syntax simple only the instance
|
||||
version of the raise syntax would be supported (no variants for
|
||||
"raise string" or "raise class, instance").
|
||||
|
||||
throw([expression, [expression, [expression]]])
|
||||
|
||||
Accordingly, it should be implemented to handle all of the following:
|
||||
|
||||
raise string g.throw(string)
|
||||
raise string, data g.throw(string,data)
|
||||
raise class, instance g.throw(class,instance)
|
||||
raise instance g.throw(instance)
|
||||
raise g.throw()
|
||||
Calling "g.throw(instance)" would correspond to writing
|
||||
"raise instance" immediately after the most recent yield.
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue