[Twisted-Python] PEP 342 now in python CVS

Bob Ippolito bob at redivi.com
Wed Aug 17 20:24:45 EDT 2005


On Aug 17, 2005, at 1:20 PM, Christopher Armstrong wrote:

> On 8/18/05, tazzo <tazzo at email.it> wrote:
>
>> Hi all,
>> referring to the news about the implementation of PEP 342 in  
>> python CVS:
>>
>> http://dirtsimple.org/2005/08/pep-342-implementation-now-in-cvs.html
>>
>> I know that is a great news for asynchronous programming in python  
>> and for
>> other aspects but I wonder what will be the future of  Twisted, what
>> will change
>> (if something will change) in Twisted when PEP 342 will come?
>> I think that with PEP 342 we could write a more readable code but  
>> does
>> it mean
>> rewrite all twisted?
>> What is the opinion of  Twisted developers??
>>
>
> Have you seen Deferred Generators, in twisted.internet.defer
> (deferredGenerator and waitForDeferred are relevant)? I'm planning on
> either adding support for PEP342-style generators to them, or writing
> an alternate implementation specifically for PEP342. I'm happy about
> PEP342, because it means I'll no longer have to install a buggy C
> extension module (greenlet) to get decent cooperative threading.
>
> This integration is very lightweight and doesn't require any mangling
> of the guts of Twisted.
>
> I'll just note that I am mostly alone amongst the developers of
> Twisted who think that this kind of cooperative threading + Deferred
> integration is a good idea. Glyph, Jp, and Allen Short (as he posted)
> have all said it's a bad idea to have such magical code. On the other
> hand, it's definitely not as bad as pre-emptive threading, where you
> basically can't know where context switches will happen.

I think it's a good idea, so long as you know when to use it.  It's  
particularly useful when doing things that are inherently serial when  
you don't need the power of arbitrary call graphs hooked up to your  
asynchronous goodness.

-bob





More information about the Twisted-Python mailing list