Ethan Furman added the comment: Here's the excerpt from the docs: -------------------------------- > Yield expressions are 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 certainly makes it sound like 'yield' is okay in the 'try' portion, but not the 'finally' portion. So 'yield' is allowed in the 'try' portion, and it's allowed in the 'finally' portion -- is it also allowed in the 'except' portion? If so, we could simplify the first line to: > Yield expressions are allowed in try ... except ... finally constructs. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22988> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com