[Python-ideas] Cofunctions: It's alive! Its alive!

Jack Diederich jackdied at gmail.com
Tue Aug 10 14:10:44 CEST 2010


On Tue, Aug 10, 2010 at 3:22 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>
>> We'll see. I still cannot get my head around why cofunctions are so
>> great.
>
[snip]
> Here's the equivalent thing using cofunctions, complete with a
> corresponding missing 'cocall':
>
[snip]
> The exception and traceback resulting from this is crystal clear:
>
> Traceback (most recent call last):
>  File "restaurant2.py", line 34, in <module>
>    run()
>  File
> "/Local/Projects/D/Python/YieldFrom/3.1/Cofunctions-3.1.2/Examples/Simulation/simulation.py",
> line 25, in run
>    next(current_process)
>  File "restaurant2.py", line 29, in customer
>    hold(random.normalvariate(10, 5))
> TypeError: Cofunction must be called with cocall or costart
>
> If this doesn't convince you of the utility of cofunctions or
> something like them, I don't know what will.

So the benefit of cocalls is runtime type checking? Are your unit tests broken?

I was -0 on ABCs and function annotations because I was promised by
people that liked them that I could safely ignore them.  I can't
safely ignore this so I'm -1.

-Jack



More information about the Python-ideas mailing list