Twisted, gevent eventlet - When would I use them
Under what circumstances would something like event开发者_运维知识库let/gevent be better than twisted? Twisted seems like the most used, but eventlet/gevent must have some advantages... I'm not looking for an answer to a specific scenario, just generalities.
It's an issue of aesthetic preference, I think.
First of all, eventlet can actually use Twisted for networking, so in a sense, it's not an either-or question, it's a this-is-built-on-top-of-that question.
Personally, I don't see the need for libraries like gevent or eventlet, especially since the advent of the @inlineCallbacks
decorator in Twisted, which already write code which sorta looks like it's blocking.
But, if you have a large library of code which already uses threads, and you want to port it to be event-driven, something like eventlet can save you some typing, since you don't need to insert 'yield
's everywhere.. Some people, like the guys behind the EVE online game, think that code written in this style is just better for some things, such as AI code.
精彩评论