[Twisted-Python] serializing inline callbacks

Axel Rau Axel.Rau at chaos1.de
Tue Feb 18 08:11:06 MST 2014


Am 17.02.2014 um 23:58 schrieb Dustin J. Mitchell <dustin at v.igoro.us>:

> Async programming aside, this mode of chaining multiple methods
> doesn't sit well with me:
> 
> def A()
>  # .. do stuff
>  B()
> 
> def B()
>  # .. do stuff
>  C()
> 
> I think it'd be more idiomatic to have a controlling method that
> indicates the chaning:
> 
> def do_stuffs():
>  A()
>  B()
>  C()
>  D()
>  D()
>  D()
> 
> Now, translating that to async programming with inline callbacks is easy:
> 
> @defer.inlineCallbacks
> def do_stuffs()
>  yield A()
>  yield B()
>  yield C()
>  yield D()
>  yield D()
>  yield D()
> 
> Dustin

Thanks, but the calls in C depend on the data (program branches).
There are 8 different call parameter sets dependent on contexts.

Axel
---
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius





More information about the Twisted-Python mailing list