Hacker Newsnew | comments | show | ask | jobs | submitlogin

Both languages are very good. JavaScript has its kinks, but they are not hard to work around with library support or syntax translations (such as CoffeeScript). However, JavaScript's execution model is simple and doesn't provide as much value as the one in Python does, and this is something that is not easily addressed with libraries or (simple) translations.

By this I refer to that in Python, most syntactic constructs map to more primitive operations that are accessible (and overridable) in the language itself. For example, anything can be made callable, indexable, sliceable, iterable, etc., by providing the right interface. It is like operator overloading on steroids. Even attribute access (the dot operator) can be overridden in extremely powerful ways. This is great for library writers, who can use it to provide the simplest possible API to their users.

I also like very much Python's data model. Things consistently behave as references (even primitive values which all behave as immutable singletons, although of course they are not implemented as such). It just somehow fits and makes sense once you have the model in your mind. JavaScript is slightly less intuitive in this way, and while it makes sense once you understand it, there are a few caveats you need to keep in mind (variable hoisting, scoping, anticipating different context objects). Prototype inheritance works fine but requires a special mind-set, and to me it seems JS fits better for functional programming than object-oriented Java-style.

Python's shortcomings are mainly syntactical (not counting the shortcomings of CPython's implementation specifically), such as not having an easy syntax for function expressions. This is the main reason functional programming can get slightly awkward in Python.




ES6 will allow for low-level extensibility with Proxies (http://wiki.ecmascript.org/doku.php?id=harmony:proxies).

-----


That's true, and definitely worth pointing out. I've used them a fair bit, and while they provide exellent power, they are slightly cumbersome to use compared to Python's pervasive "overloadability" (for the lack of a better word). But I would give them a chance to grow on me before passing any further judgement.

-----




Applications are open for YC Summer 2015

Guidelines | FAQ | Support | Lists | Bookmarklet | DMCA | Y Combinator | Apply | Contact

Search: