3 Apr
2009
3 Apr
'09
3:51 a.m.
Bruce Frederiksen wrote:
If you re-define close to return the value attached to StopIteration,
There may be a misconception here. I haven't been intending for close() to return the return value. That's not necessary to support Jacob's desire for the subgenerator to be able to return a value while the outer generator is being closed. That's because the subgenerator would *not* have its close() method called -- rather, GeneratorExit would be thrown into it. If it returned, this would manifest as a GeneratorReturn which could be caught and treated accordingly. I wouldn't necessarily be against having close() return the value from GeneratorReturn, but that's a separate issue to be decided independently. -- Greg