[Stackless] Coding Example Re: The case for Twisted

Andrew Francis andrewfr_ice at yahoo.com
Fri Aug 17 10:43:34 CEST 2007

Hi Folks:

What I believe a good Twisted/Stackless integration
brings to the table is a simple solution to "stack
ripping." This is what I will argue when I present my
experiences with Stackless and Twisted in the
construction of WS-BPEL processors at the September
Ottawa Python User's Group meeting. 

Here is a coding example based on a test driver I
wrote a few months ago (see June 30th post - the
stackless web site seems to be down). I apologize for
the driver being bulky but I was using it to hunt down
a bug and to prototype ideas. 

In this example, I can invoke the Twisted getPage()
method but hide the details of deferreds. 

a code snippet:

 def execute(self):
            the processor's underlying machinery hides
all the
            Twisted deferred information
            actual Twisted call client.getPage() that
returns a deferred
            result =
            #print the message
            print result
        except TwistedException:
            log.msg("A Twisted Exception was thrown")
(I can also show how calls can be made from a request

I believe this provides a much nicer experience for
Stackless developers interested in writing network
applications (with Twisted). 

Although I don't necessarily need it, I don't see why
this approach could not be generalised to cover the
enter Twisted framework.

I would appreciate comments.


Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: StacklessTwistedReactor.py
Type: text/x-python
Size: 9731 bytes
Desc: pat2074224355
URL: <http://www.stackless.com/pipermail/stackless/attachments/20070817/2ce5dbb3/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestTasklet.py
Type: text/x-python
Size: 1332 bytes
Desc: pat701780254
URL: <http://www.stackless.com/pipermail/stackless/attachments/20070817/2ce5dbb3/attachment-0001.py>
-------------- next part --------------
Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list