2 ms·
I use Twisted Python, and disagree that async is too hard. Lets sprinkle a bit of syntactic sugar over Twisted and consider this example: @defer.inlineCallba
by fragmede 17y ago
I use Twisted Python, and disagree that async is too hard. Lets sprinkle a bit of syntactic sugar over Twisted and consider this example:
@defer.inlineCallbacks # Python2.5 and up
def login_and_do_something(args):
server = yield factory.login(username, password)
rval = yield server.callRemote(args))
print rval
It looks fairly straightforwards and isn't the complete change to coding style that has mortal programmers scrambling for the hills. Doing the same without inline callbacks, I must admit, is quite a bit more to wrap your head around.