[Stackless] Re: Why does xsdb use stackless?

Aaron Watters aaron at reportlab.com
Wed Dec 10 17:27:50 CET 2003

whoops... forgot to reply to stackless list.

Aaron Watters wrot

> Itamar Shtull-Trauring wrote:
>>On Wed, 2003-12-10 at 10:50, Aaron Watters wrote:
>>>Unrolling the application at each point where you need to wait
>>>simply turns the code inside out (just like unrolling
>>>a set of recursions).  Threading is the only
>>>acceptable alternative...
>>Mmm, for some things tasklets make things a lot nicer, but I don't agree
>>threads are the only acceptable alternative. For code that is a state
>>machine (which most network protocols are), it actually works pretty
>>well. ...
> I agree, but database applications are not natural state machines. 
>  You really want
> def myfunction(...):
>       do some initialization
>       while I'm not done:
>               prepare for the query
>               result = do_query(some arguments)
>               process the query...
>        do some other stuff...
> def do_query(some arguments):
>       if condition1:
>              return query(xxx)
>       elif condition2:
>              return query(yyy)
>       else:
>              return query(zzz)
> and if the query function needs to wait, it should wait.  You don't 
> want to have
> to unravel the above logic into 15 tiny functions using registered 
> callbacks, etcetera.
> I'd go further and argue that the reason so many network protocols
> are so strange is because they have been designed around the limitations
> of state-machine type implementations.
> I really think stackless type functionality makes a tremendous amount 
> of sense
> and I still wish it would get folded into standard Python.
>     -- Aaron Watters

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20031210/ecfcc3a8/attachment.htm>

More information about the Stackless mailing list