[Python-ideas] Cofunctions - an enhancement to yield-from

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Aug 2 02:13:00 CEST 2010


ghazel at gmail.com wrote:

> What I am suspicious of is automatically making calls to cofunctions
> from within a cofunction imply 'yield from'. Knowing whether the
> function call you are making can suspend your code and return to your
> parent or not is important,

The same situation occurs when dealing with threads, since any
function you call could potentially suspend your thread. This
doesn't seem to bother people much.

> I would like to
> see a different calling mechanism when calling a cofunction,

The main point of the whole thing is to avoid having to specially
mark call sites like this. If you take that away, all that's left
is the ability to define a generator without a yield, and I'm
not sure it's worth having a whole new kind of function definition
just for that.

-- 
Greg



More information about the Python-ideas mailing list