Any advantage in LISPs having simpler grammars than Python?

Douglas Alan nessus at mit.edu
Tue Mar 7 19:15:10 EST 2006


Grant Edwards <grante at visi.com> writes:

> On 2006-03-07, seberino at spawar.navy.mil <seberino at spawar.navy.mil> wrote:

>> Is there any advantage to a language having a nice mathematically
>> compact grammar like LISP does? (or at least used to?)

Yes, Lisp's syntax allows for a very powerful macro mechanism that is
extremely useful.

> Yes.  Grammars like LISP's make it easy for programs to generate and
> read code. Grammars like Python's make it easy for humans to
> generate and read code.

I find Lisp to be perfectly readable.  In fact, in some ways I find it
to be more readable than any other language, including Python.  I
like, for instance, the prefix notation, since then I can identify the
sort of expression that I am looking at without having to look ahead
into the expression.

For instance, if Python were to have been designed so that you would
write:

   let myVeryLongVariableName = 3

I would have preferred this over

   myVeryLongVariableName = 3

With the latter, I have to scan down the line to see that this line is
in an assignment statement.

(This problem is significantly worse in C++, where variable
declarations can be rather difficult to visually parse, unless all
classes begin with capital letters and nothing else does.)

>> Many have admired the mathematically simple grammar of LISP
>> in which much of the language is built up from conses IIRC.

>> Python's grammar seems complicated by comparison.

>> Is this anything to worry about?

No, not really.  Not unless you want a powerful macro facility or you
want to programmatically analyze or manipulate your software.

|>oug



More information about the Python-list mailing list