Hacker News new | past | comments | ask | show | jobs | submit | ftartaggia's comments login

Could you describe the difficulties you encountered with Tornado and asynchronous Python code?


Don't want to turn this into a Node.js/Python flame war (we love Python as well here at MileWise), but regarding asynchronous Python code:

It's more just an annoyance of the language. Specifically, anonymous functions are must easier in JavaScript, so it was just easier to write read and write maintainable code.

In Python, you are limited to only passing in simple lambda functions (although deferreds do get around this issue somewhat). It's not a show stopper but when combined with all the other advantages of Node.js, it just made the decision to switch a lot easier.

We also ran into a lot of issues related to poor garbage collection in Python and were using up a lot of memory. This was not related to dangling references but rather Python's permanent allocation of Integer and Float objects.

Finally, we just saw better performance out of V8 than Python (although we never tried anything else besides vanilla Python 2.6).

For our specific problem, Node.js worked well. It's not always the right solution. We will write a more detailed blog post soon with specifics of how we used Node.


>> It's more just an annoyance of the language. Specifically, anonymous functions are must easier in JavaScript, so it was just easier to write read and write maintainable code.

That's pretty specious. You can easily write a function defined inside a function that you can pass by just naming it. "Anonymous" functions are just syntactic sugar. Furthermore, writing a new python named function is easier (fewer chars) to write than a javascript anonymous function, so the "sugar" gained is moot.

Finally, as you build more and bigger systems, you realize that those multi-line anonymous functions you had you actually want to be named (for documentation) and tested. So you'll end up de-anonymizing the complex (multi-line) ones anyway.

As for speed, why not compare a jit (v8) to a jit (pypy) ?


This is getting ridiculous. These guys were busy launching a product, not trying to write a balanced comparison of the pros and cons of every evented framework out there.

Node worked better for them, what's the problem?


Writing functions inline is a huge win, not just because of the number of characters you have to type.

It creates less noise and busy work in your code.

Explicitly specifying functions like having to pre-declare all your variables at the top of your scope.


I don't see how it's specious to prefer javascript syntax over python syntax for asynchronous code. It's an aesthetic consideration and so it's less about the fact that you can have the same sorts of functionality and structures in both environments and more about which style people prefer.

I really don't understand why whenever somebody switches to node from python people pounce on them like this, as if people aren't allowed to find a particular syntax annoying?


While it doesn't help you for the other issues you mentioned, I have found defer.namedCallbacks to make Twisted code much simpler to read.


Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: