Hacker News new | ask | show | jobs
by joecarpenter 4743 days ago
> Greenlets don't magically make synchronous libraries asynchronous! That's gevent!

That's right - I wrote that they allow writing code in synchronous fashion and I didn't say that it happens automagically though.

> That might be true, but then you need to keep in mind that callbacks doesn't necessarily mean something-looking-like-the-Tornado-callback-demo-code.

Yep, I also provided how Futures and generator-based coroutines can be built on top of the callbacks.

Just in case, Tornado supports both out of the box.

> The twisted equivalent of this wouldn't even look like data = yield get_more_data(); Twisted's API calls you when there's data, so it looks even simpler

Very similar to some Tornado API too - method of a class that gets called when something happens. For example, sockjs-tornado follows this convention.

> - Twisted predates PEP-8's recommendation of snake_case ;-)

Yes, I'm aware of it, but before I started playing with asynchronous libraries, I had some Python experience and got used to underscore naming convention. While it is easy to switch between both, I'd prefer consistent code style. Especially when I mix typical Flask Web application with real-time portion in same application.

No doubt, Twisted is mature and featureful framework. When I was investigating different options, Twisted was first one I tried. However, I also tried Tornado and found it easier to start with. And because Tornado worked for me, I decided to stick to it.