New submission from Nikolaus Rath <nikol...@rath.org>:

>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.

----------
assignee: docs@python
components: Documentation
messages: 141724
nosy: Nikratio, docs@python
priority: normal
severity: normal
status: open
title: Language References does not specify exception raised by final yield()
type: feature request
versions: Python 2.6, Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12704>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to