[Twisted-Python] serializing inline callbacks
Dustin J. Mitchell
dustin at v.igoro.us
Mon Feb 17 15:58:14 MST 2014
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
More information about the Twisted-Python
mailing list