开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜