[Twisted-Python] Consensus on speed of deferred call/errback-style execution?

Jean-Paul Calderone exarkun at divmod.com
Fri Oct 24 16:27:05 EDT 2008

On Fri, 24 Oct 2008 21:40:01 +0200, Terry Jones <terry at jon.es> wrote:
> [snip]
>I might play a little more. I was going to write some code to generate
>different varieties of behaviorally-equivalent but differently structured
>code. In fact I think it wouldn't be hard to write something that could
>write your code for you in a variety of ways. E.g., you could write
>pseudo-code like
>  a = A()
>  if a < 45:
>     b = B()
>     c = a + b.hey() - C()
>     if c:
>       return D(12, c)
>     else:
>       return E()
>  return F(a)
>and something digs through this code, figures out (maybe via a decorator
>used on functions returning a deferred - ugh, but it's just one suggestion)
>which of A, B, C, D and E return deferreds and spits out code to handle
>things for you.

Possibly, but maybe trickier than you hope.  This is basically what is
called the "stackless transform" in PyPy.  It's about a thousand lines
for them to implement, and it only works on RPython, not Python.


More information about the Twisted-Python mailing list