[Python-ideas] Cofunctions - Back to Basics
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Oct 27 04:09:42 CEST 2011
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:
http://www.cosc.canterbury.ac.nz/greg.ewing/python/generators/cd_current/cofunction-pep-rev5.txt
together with updated examples here:
http://www.cosc.canterbury.ac.nz/greg.ewing/python/generators/cd_current/Examples/
and prototype implementation available from:
http://www.cosc.canterbury.ac.nz/greg.ewing/python/generators/cofunctions.html
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.
--
Greg
More information about the Python-ideas
mailing list