Hacker News new | ask | show | jobs
by dlsspy 5756 days ago
@inlineCallbacks make linear code very easy to write in twisted. Have you tried it lately? Here's a snippet of code out of my gearman implementation:

    @defer.inlineCallbacks
    def gclient(gearman):
        w = client.GearmanClient(gearman)
        x = yield w.submit('test', 'some data')
        print "result:", repr(x)
Pretty straighforward, I think -- you just stick a 'yield' between your invocation and the capture of the results.

As far as who's using in actual comet applications -- it's hard to say. The last time I tried looking for a comet implementation, what appeared to be the canonical "cometd" was written in twisted. I ended up not using it and rolled my own twisted based server that was closer to my requirements. It's been in production for a few years now, but is still a somewhat secret project.

I'm pretty sure you could research their userbase as well as I could.

I'm not saying twisted is perfect and all other technology sucks (though deferreds, once you understand them, are really the only way to do this sort of thing).

When tornado was launched, I started playing with it and couldn't understand why it prevented me from integrating so many asynchronous tasks. I spent an hour or two separating the good parts of tornado from the reimplementation of twisted and built tornado on top of twisted. It was, as far as I could tell, at the starting point, minus 1,297 lines of python.