26 Mar
2009
26 Mar
'09
4:38 a.m.
Greg Ewing wrote:
Nick Coghlan wrote:
I'm not so sure about that - we don't do it for normal iteration, so why would we do it for the new expression?
Because of the inlining principle. If you inline a subgenerator, the result is just a single generator, and closing it finalizes the whole thing.
That makes perfect sense to me as a justification for treating GeneratorExit the same as any other exception (i.e. delegating it to the subgenerator). It doesn't lead me to think that the semantics ever need to involve calling close(). Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia ---------------------------------------------------------------