[Python-ideas] Possible PEP 380 tweak (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Oct 28 23:37:17 CEST 2010


Jacob Holm wrote:

The new exception is needed because "cocall func()" can never raise the regular StopIteration (or any subclass thereof).

Botheration, I hadn't thought of that!

I'll have to think about this one. I still feel that it shouldn't be necessary to define any new protocol -- one ought to be able to simply write a next cofunction that looks like a normal one in all respects except that it's defined with 'codef'.

Maybe a StopIteration raised inside a cofunction shouldn't be synonymous with a return, but instead should be caught and tunnelled around the yield-from via another exception.

-- Greg



More information about the Python-ideas mailing list