python vs ecmascript

Kragen Sitaker kragen at canonical.org
Tue Nov 20 11:51:35 CET 2001


"Peoter Veili" <peoter_veliki at hotmail.com> writes:

> Anyone familiar with ECMAscript (JavaScript)?  How does it compare to
> Python?

I'm reasonably familiar with it.

Here are my thoughts, including summarized thoughts earlier on this thread:

JavaScript, of course, is the standard language for writing
HTML-page-embedded client-side scripts; it is the only language that
is a contender here.

Python's syntax is mostly nicer.

Python has a module system so you can reuse code in multiple programs
without cutting and pasting it and so you can keep your code files
small and manageable.

Python makes it easier to define classes.  JavaScript notionally has
prototype-based inheritance like Self, but in reality, it ends up
having class-based inheritance, although of a particularly lightweight
sort.

Python doesn't have (many) implicit conversions, which means your code
gives you errors instead of giving you wrong answers with no
indication that they are wrong.

JavaScript development environments are mostly pretty terrible.
Python's are reasonable.

JavaScript unifies objects and dictionaries; the keys of a dictionary
are the same as the attributes of an object.  This sometimes has
disadvantages.

Python has a large and good standard library.  JavaScript doesn't.

Python has a number of good nonstandard libraries.  JavaScript might,
but I haven't found them.

JavaScript has nested lexical scopes, including closures.  Python
didn't until 2.1, and they're still turned off by default.

JavaScript makes all variables global by default, and its lack of a
module system worsens this.  This is an unbelievably stupid idea.

JavaScript has an ECMA standard and multiple implementations.  Python
doesn't have a standard, and only sort of has multiple implementations.






More information about the Python-list mailing list