Why is Python popular, while Lisp and Scheme aren't?
Pascal Costanza
costanza at web.de
Wed Nov 20 20:13:33 EST 2002
Delaney, Timothy wrote:
>>From: Pascal Costanza [mailto:costanza at web.de]
>>
>>Meiner Meinung nach hängt das im wesentlichen immer davon ab, welche
>>Sprache man zuerst gelernt hat, oder welche man am häufigsten benutzt.
>>
>>If you don't understand this, would you consider German to be less
>>readable than English? (Run that sentence through
>>http://babelfish.altavista.com to get my point. ;)
>
>
> Having been involved in these debates before, I now try to avoid them
> (except when trying to get Python used on a project ;)
>
> However, you measure readability by how readable something is at comparable
> skill levels. So if I were fluent in both German and English (I'm not),
> *and* you had provided the English version (not necessarily a direct
> translation, but the equivalent meaning) then I could make a judgement. If I
> had no fluency in either, I could not make a meaningful judgement.
No, I am saying that many statements about the readability of
programming languages are made from a perspective of being fluent in one
but not in the other language. I don't think that there are any
programming languages that are per se more readable than others. Heck,
this isn't even true for natural languages. That's the whole point of my
argument. I could have made this example even more extreme by giving it
in Japanese, or sign language, or Braille language.
> Likewise, the readability of Lisp vs Python can be determined at various
> skill levels. The most masic skill level is no fluency in either language,
> but fluency in English. At such a level, Python definitely is most readable
> (even someone who has neve seen Python code before can make some sense of
> Python code - the same cannot be said for Lisp).
So which of the two following expressions do you find more readable.
According to your statement it should be the first because it's closer
to English.
1) ADD A TO B GIVING C
2) c = a + b
Further note that the second expression doesn't make sense in any
language other than a certain family of programming languages. For
example, it doesn't make any sense in mathematics. (There, "=" expresses
an equality, not an assignment.)
So why is it the case that many programmers find the second expression
more readable without being able to refer to anything outside of the
realm of programming languages?
> Another skill level is
> "expert" in both languages. I don't claim to be expert in Lisp - I have a
> passing familiarity with it, and so cannot judge. But I suspect that for an
> expert in *both* languages, Python is still more readable, even when Lisp is
> nicely formatted.
It's probably the case that for simple tasks, Python code is generally
more readable than Lisp code. However, Lisp wasn't designed as a
language for simple tasks. As soon as you get to the complicated tasks,
I don't expect Python to be superior to Lisp with regard to readability.
The fact that Lisp provides macros enables you to make your code even
more readable because they allow you to express a solution close to the
terms of the problem domain (as opposed to the terms of the solution
domain - the programming language).
Many people complain about the Lisp syntax, i.e. the parentheses, but
there's a deeply-rooted technical reason for that choice. The single
most important feature of Lisp is that code and data are the same. All
other languages I know of don't have this feature on the same level of
maturity. In Python and other scripting languages you can create strings
at runtime that contain code, and you can execute those strings by means
of exec, eval or the like. That's a similar feature - however, in Lisp
both code and data are structured equally by default. (In contrast,
strings always have a flat structure whereas code is nested
hierarchically in almost all cases.)
The fact that the Lisp syntax uses lots of parentheses is a result of
this feature that code and data are the same. It's just the most
straightforward way to have a single notation for both. In fact, it
would be more appropriate to say that the Lisp syntax is the closest
thing to having _no_ syntax at all. In all other languages, compilers
and interpreters need to parse a program and translate it into an
internal abstract syntax tree representation. In Lisp, the code you see
is (more or less) exactly that abstract syntax tree! Code = data!
This feature (code = data) guarantees that you can never lack in
expressive power. No matter what an arbitrary Lisp standard provides,
you can always provide your own abstractions that have an equal status.
It's trivial to state that you can do anything with most programming
languages, because all general-purpose programming languages are (by
definition) Turing-complete. However, the code=data feature goes way
beyond Turing completeness. Of course, this level of expressive power
has its dangers - you can't afford to be sloppy when programming in
Lisp. However, there are many people who don't want to give up this
amount of expressive power once they have started to appreciate it, and
they appreciate Lisp's syntax exactly for the same reason.
The ability to read Lisp code then emerges naturally from this
appreciation. ;)
Here is some more food for thought related to this argument:
http://www.paulgraham.com/rootsoflisp.html
Pascal
--
Given any rule, however ‘fundamental’ or ‘necessary’ for science, there
are always circumstances when it is advisable not only to ignore the
rule, but to adopt its opposite. - Paul Feyerabend
More information about the Python-list
mailing list