Actually, "Why not Twisted?" is still a good question. If they have a good reason, let's hear it. If you want to choose between this and Twisted, that's information you need.
One huge Twisted advantage is that you can have your async comet reactors running in the same process as other Twister reactors, which can be very useful for many applications you might want Comet for. What's the payoff for using this instead?
BTW: These are straight questions, not sarcastic questions. I am perfectly willing to extend benefit of the doubt and assume there are good answers. I just don't know what they are, and I'd like to know, as I am potentially looking to use some stuff like this myself in the near future.
Twisted is a very capable system, very well written, with all kinds of capabilities that diesel doesn't have and never will. So it's not a capabilities thing.
It's written by a team of guys who are crazy smart, and who know async better than most people on the planet, me included. So it's not a competence thing.
The performance difference between twisted and most other Python async libraries isn't going to be significant. We're all mostly benchmarking epoll or select or whathaveyou, plus a thin layer of frames to get from there to your application code. So it's really not a performance thing either, though hackers love to talk about this anyway.
It's a style thing. Twisted doesn't feel "Pythonic" to me. It doesn't have that succinctness that makes you say "shit, I'm done already?" It's got lots of big-A architecture that's very Correct, but in practice, leaves you wondering why you're being burdened with it when that rainy day when it pays dividends never comes. Purity is allowed to triumph over practicality at every turn.
That's one man's take. I don't claim it's the universal truth, and Twisted has many very happy users. But I suspect I'm not alone in this assessment.
That being said, I will relish the day when someone can do _something_ in the Python async space and not immediately be thrust into the ring as the latest combatant in the twisted-vs-the-new-guy debate. New guys never stop coming, and that's a wonderful thing for the evolution of computing and programming.
Every time you have to do asynchronous work, you have to mentally follow the chain of deferreds to ensure you understand exactly what code will be called at what time. Coupled with its unpythonic, deep hierarchical API, Twisted almost literally twists your code into a jumbled blob.
Unless you need the existing protocol-specific APIs twisted provides, stay far, far away. Find something more lightweight, like this, or Eventlet, or something else that lets your code remain concise and clear.
This comes from my experience writing a Twisted server for my startup, and subsequently rewriting it when the Twisted version became far too difficult and frustrating to maintain.
I'm sorry, but this post is just packed full of FUD.
I hear this all the time, "argh, Deferreds are so hard to understand," as if there's some kind of magic going on in a Deferred. Deferreds are just a way to encapsulate two callbacks, one for errors and another for successful callbacks.
If you're writing any kind of significantly complicated asynchronous process, what is the difference between following a bunch of Deferreds and following a bunch of callbacks??
Asynchronous coding is hard. There's no framework that is going to make that go away. Diesel looks nice enough, but although it shows promise, there's not enough examples of hardcore usage to make a sufficient comparison. An asynchronous IO framework that has nothing but HTTP and echo examples doesn't even scratch the surface of the kinds of apps that require the advanced asynchrony available in Twisted.
If you're writing any kind of significantly complicated asynchronous process, what is the difference between following a bunch of Deferreds and following a bunch of callbacks??
The difference is that in co-routine based code (such as concurrence or eventlet) there are no callbacks. Co-routines are all about message passing which leads to much cleaner and much less code in most applications.
It's not uncommon to see 40%+ boilerplate callback-handling code in a twisted app. Those are not needed in a coro-environment.
Asynchronous coding is hard.
Actually the established patterns for implementing asynchronous code are hard. You get to choose between threading-hell (deadlocks, races) and callback-hell (code-bloat). I have no idea why these abstractions grew so popular, my guess would be because they are "closest to the metal".
But they are not without alternatives; co-routines, actor-based concurrency and erlang exist - all of which enable fairly straightforward "Do what I mean" development.
I've been including Eventlet in a lot of my comments lately, but not because I have any affiliation with it (I don't). But it has quite literally made asynchronous coding so much easier that going back to deferreds or callbacks is a huge inconvenience.
My comments previously reflect equally on deferreds and callback-based asynchronous programming. Of course those make async programming hard.
One huge Twisted advantage is that you can have your async comet reactors running in the same process as other Twister reactors, which can be very useful for many applications you might want Comet for. What's the payoff for using this instead?
BTW: These are straight questions, not sarcastic questions. I am perfectly willing to extend benefit of the doubt and assume there are good answers. I just don't know what they are, and I'd like to know, as I am potentially looking to use some stuff like this myself in the near future.