some generator issues

Neil Mix nmix at pandora.com
Mon Apr 23 10:55:14 PDT 2007


>> One library I've been looking
>> at is the Twisted framework, or rather it's Deferred component. It's
>> solution to this issue is an inlineCallbacks function intended to  
>> wrap a
>> generator function within some sort of generator manager:
>> http://twistedmatrix.com/documents/current/api/ 
>> twisted.internet.defer.html#inlineCallbacks.
>
> Yes, this is familiar too from MochiKit, which was inspired by  
> Twisted. But the question you raise remains: should there be a more  
> convenient, primitive way to denote the current generator-iterator  
> from within its generator function?

I think yes.  Perhaps I'm over-generalizing, but it seems to me that  
because python has blocking I/O, inlineCallbacks is the outlier use- 
case.  I don't think the same can be said of JavaScript since it  
typically has no blocking I/O.

So if new keywords are verboten, and arguments.generator is verboten  
(which would be better than nothing, I say), then what's left?  Is a  
static method on the Generator class a reasonable option?



More information about the Es4-discuss mailing list