31 Mar
2009
31 Mar
'09
2:09 p.m.
Nick Coghlan wrote:
4, 3, 2, 1 is the position I've come around to. [...] What he said.
I think that 4 also has the advantage of raising RuntimeError in the inner generator's close method (using the definition of close provided in PEP 342) when the inner generator doesn't obey the rules for GeneratorExit laid out in PEP 342. Throwing GeneratorExit to the inner generator causes the outer generator's close to report the RuntimeError, which pins the blame on the wrong generator (in the stack traceback, which won't even show the inner generator). -bruce frederiksen