
On Tue, 10 Aug 2010 08:10:44 -0400 Jack Diederich <jackdied@gmail.com> wrote:
On Tue, Aug 10, 2010 at 3:22 AM, Greg Ewing <greg.ewing@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?
Isn't "runtime type checking" just another way to say "duck typing"? Would you be happier if the error message was "'Cofunction' object is not callable", so it was matched the error you get when you call other non-callable objects? Given two features that are otherwise equivalent - which seems to be the case with yield-from vs cocalls - I'll take the one that makes debugging easier.
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.
I don't see how you can ignore any feature that some program you're trying to debug makes use of. <mike -- Mike Meyer <mwm@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org