[Twisted-Python] Mixing generator style (yield+twisted.flow) functions with deferreds?

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Tue Mar 21 15:29:03 EST 2006


>     def someFunction(name):
>         x = 1
>         print name, x
>         yield None
>         x += 1
>         print name, x
>         yield None
>         d = defer.waitForDeferred(funcReturnDef(x))
>         yield d
>         x = d.getResult()
>         print name, x
>         ...
>     someFunction = defer.deferredGenerator(someFunction)

GREAT!  Thank you very, very much!

Minor note, I am not sure to whom - I think that such example 
deservers its place in Twisted tutorial. Or maybe it is there? 
But I tried reading docs carefully and failed to find such a 
thing....




More information about the Twisted-Python mailing list