
[Phillip J. Eby]
And there was much rejoicing in the land of the co-routiney people. :) +1000.
Should this maybe just be added to PEP 342? To me, PEP 342 has always seemed incomplete without ways to throw() and close(), but that could easily be just me. In any case I'd expect the implementation of 'next(arg)' to have some overlap with the implementation of 'throw()'.
Maybe, but on the other hand this idea can be done independently from PEP 342. After the "monster-PEP" 340, I'd rather break proposals up in small parts.
Also, if the generator yields a value upon close(), shouldn't that throw a runtime error? Otherwise, you have no way to know the generator's exception handling is broken.
Maybe. But then what should happen when this happens to close() invoked by the GC? I guess the same as when a __del__() method raises an exception -- print a traceback and go on. OK, works for me. -- --Guido van Rossum (home page: http://www.python.org/~guido/)