[Twisted-Python] PEP 342 now in python CVS

Christopher Armstrong radeex at gmail.com
Wed Aug 17 19:20:15 EDT 2005

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.

  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    -- http://radix.twistedmatrix.com
            |  Release Manager, Twisted Project
  \\\V///   |    -- http://twistedmatrix.com
   |o O|    |  

More information about the Twisted-Python mailing list