Re: [Python-Dev] PEP 334 - Simple Coroutines via SuspendIteration
At 11:36 PM 9/30/04 +0100, Michael Sparks wrote:
On Thu, 30 Sep 2004, Phillip J. Eby wrote: ...
A mechanism to pass values or exceptions into generators
[ Possibly somewhat off topic, and apologies if it is, and I'm positive someone's done something similar before, but I think it's relevant to the discussion in hand -- largely because the above use case *doesn't* require changes to python... ]
I know it doesn't; peak.events does this now, but in order to have a decent programmer interface, the implementation involves a fair amount of magic. Similarly, PEP 334 doesn't call for anything you can't do with a bit of work and magic. I was suggesting, however, that a true "simple co-routine" (similar to a generator but with bidirectional communication of values and exceptions) would be a valuable addition to the language, in the area of simplifying async programming in e.g. Twisted and peak.events. To put it another way: Slap the current title of PEP 334 onto the body of PEP 288, and change its syntax so you have a way to pass values and exceptions *in* to a suspended "coroutine" (a new and different animal from a generator), and I'm sold.
participants (1)
-
Phillip J. Eby