Still feeling in a peppish mood after the last round of PEP 335, I decided to revisit my cofunctions proposal. Last time round, I allowed myself to be excessively swayed by popular opinion, and ended up with something that lacked elegance and failed to address the original issues.
So, I've gone right back to my initial idea. The current version of the draft PEP can be found here:
together with updated examples here:
and prototype implementation available from:
In a nutshell, the 'cocall' syntax is gone. Inside a cofunction, if an object being called implements __cocall__, then a cocall (implicit yield-from) is performed automatically, otherwise a normal call is made.