[Stackless] The case for Twisted

Andrew Francis andrewfr_ice at yahoo.com
Sat Aug 11 22:38:52 CEST 2007

Hello Colleagues:

>A lot of people seem to want to write their own event
>loop for doing Stackless I/O. I think this is a waste
>of time. It's a *lot* of work to get a robust and
>portable event loop.

Christopher, I decided to take the time to learn how
to integrate Stackless with Twisted. I still have a
long way to go. However I think it is great that folks
are exploring multiple approaches and sharing their
information! We learn both from successes and
mistakes. I 

That said, I think a major disincentive to using
Twisted is the lack of technical information on
Twisted. For instance take my "lost deferred" problem.
After I failed to receive an answer and pursued a few
wrong paths (i.e., using threads, studying custom
reactors), I had to:

1. Trace through Twisted with a debugger. This meant
setting up an extra Python/Twisted distribution.

2. Pepper Twisted with extra logging information.

3. Study Twisted code.

I went through this effort because I believed Twisted
would help me in the long run. If I was in a
commercial environment, I would probably be forced to
pull the plug on Twisted use.

>There are also, of course, many opportunities for
>integration at a higher level, like being able >to
"block" on Deferreds, 

My current implementation blocks on deferreds. 
or giving a stackless API to >the Twisted protocol
system, and so forth. This is
>great, but I understand some people may not want
>something so high-level.

Christopher, I disagree. I believe most programmers
just want solutions and would be more than happy to
work with high level abstractions that save them time
and get the job done. From the little that I have seen
in the Twisted mailing list, beginners have problems
understanding deferreds. 

I don't see why a decent Stackless/Twisted integration
could not allow the following:

import  StacklessTwistedClient as client

   result = client.getPage(....)
except TwistedError:
   # do something

and let the underlying machinery (most likely a
modified reactor) take care of stuff like deferreds. I
believe that Stackless combined with Twisted can
provide a nice alternative to "stack ripping"


Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list