[Twisted-Python] Comparing "Stackless Python + Nonblocking Stackless Modules" with Twisted.

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Mon May 10 16:59:35 MDT 2010


On 02:57 am, newptcai at gmail.com wrote:
>On Mon, May 10, 2010 at 8:17 AM, Andrew Francis 
><andrewfr_ice at yahoo.com> wrote:
>>Hi Peter:
>
>>I think things get more complex when one is dealing with multiple end- 
>>points in sequence (now callbacks are chained) or one is using 
>>iterators (cooperators/coiterators now needed?). What light-weight 
>>threads do is make things synchronous and make the control flow 
>>obvious to the programmer (because one is relying on Python to provide 
>>the control flow).
>
>I have same feeling that when Twisted got quite complex when one has
>to make sequential asynchronous calls because we can't see the flow
>control because what to do next is decided in callbacks.

If you find the simple building blocks for concurrency in Twisted to not 
allow you express solutions in a clear way, that may mean that you need 
some more expressive tools to use in solving your problems.  Perhaps you 
can construct these out of the building blocks Twisted provides. 
Equally worth considering is that there may be some more expressive 
tools in Twisted already.

For example, have you looked at the cooperator API (which Andrew was 
referring to)?

http://twistedmatrix.com/documents/current/api/twisted.internet.task.html#cooperate

Jean-Paul




More information about the Twisted-Python mailing list