Message141724
From http://docs.python.org/reference/simple_stmts.html#the-yield-statement:
"As of Python version 2.5, the yield statement is now allowed in the try clause of a try ... finally construct. If the generator is not resumed before it is finalized (by reaching a zero reference count or by being garbage collected), the generator-iterator’s close() method will be called, allowing any pending finally clauses to execute."
This strongly suggests that the last-executed yield statement will raise an exception if the generator is closed. If this is the case, it would be great if the documentation could be extended to say what exception is raised.
If this is not the case, it would be great if whatever magic is happening could be documented as well. |
|
Date |
User |
Action |
Args |
2011-08-06 18:12:27 | nikratio | set | recipients:
+ nikratio, docs@python |
2011-08-06 18:12:26 | nikratio | set | messageid: <1312654346.88.0.619161172388.issue12704@psf.upfronthosting.co.za> |
2011-08-06 18:12:26 | nikratio | link | issue12704 messages |
2011-08-06 18:12:25 | nikratio | create | |
|