[Python-ideas] Yield-From: Handling of GeneratorExit
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Apr 3 09:32:15 CEST 2009
Steven D'Aprano wrote:
> Perhaps I've missed something, but it seems to me that the right limit
> to use would be the recursion limit, and the right exception to raise
> would be RecursionError rather than RuntimeError.
I'm not sure about that. The kind of code needed
to cause a problem would be something like
def i_refuse_to-die():
while 1:
try:
yield 42
except GeneratorExit:
pass
which looks more like a plain infinite loop than
anything involving recursion, so I think getting
a RecursionError would be more confusing than
helpful.
--
Greg
More information about the Python-ideas
mailing list