Python and Ruby

Jonathan Gardner jgardner at jonathangardner.net
Tue Feb 2 17:09:38 EST 2010


On Feb 1, 6:50 pm, Nobody <nob... at nowhere.com> wrote:
> On Mon, 01 Feb 2010 14:13:38 -0800, Jonathan Gardner wrote:
> > I judge a language's simplicity by how long it takes to explain the
> > complete language. That is, what minimal set of documentation do you
> > need to describe all of the language?
>
> That's not a particularly good metric, IMHO.
>
> A simple "core" language doesn't necessarily make a language simple to
> use. You can explain the entirety of pure lambda calculus or combinators
> in five minutes, but you wouldn't want to write real code in either (and
> you certainly wouldn't want to read such code which was written by someone
> else).
>
> For a start, languages with a particularly simple "core" tend to delegate
> too much to the library. One thing which puts a lot of people off of
> lisp is the lack of infix operators; after all, (* 2 (+ 3 4)) works fine
> and doesn't require any additional language syntax. For an alternative,
> Tcl provides the "expr" function which essentially provides a sub-language
> for arithmetic expressions.
>
> A better metric is whether using N features has O(N) complexity, or O(N^2)
> (where you have to understand how each feature relates to each other
> feature) or even O(2^N) (where you have to understand every possible
> combination of interactions).
>
> > With a handful of statements,
> > and a very short list of operators, Python beats out every language in
> > the Algol family that I know of.
>
> Not once you move beyond the 10-minute introduction, and have to start
> thinking in terms of x + y is x.__add__(y) or maybe y.__radd__(x) and also
> that x.__add__(y) is x.__getattribute__('__add__')(y) (but x + y *isn't*
> equivalent to the latter due to __slots__), and maybe .__coerce__() gets
> involved somewhere, and don't even get me started on __metaclass__ or
> __init__ versus __new__ or ...
>
> Yes, the original concept was very nice and clean, but everything since
> then has been wedged in there by sheer force with a bloody great hammer.

I strongly suggest you read the documentation on these bits of Python.
If you're scared of __new__ versus __init__, then you haven't been
programming very long in any language. There is a case when you need
one over the other. The same goes for the other concepts.

Programming languages that don't provide these features (like
Javascript) are nice for toy programs, but lack the power to
accommodate the needs of large apps.



More information about the Python-list mailing list