merits of Lisp vs Python

josephoswaldgg@hotmail.com josephoswald at gmail.com
Thu Dec 14 05:26:40 EST 2006


Christophe wrote:
> josephoswaldgg at hotmail.com a écrit :
> > Bjoern Schliessmann wrote:
> >> Robert Uhl wrote:
> >>
> >>> Because it's the language for which indentation is automatically
> >>> determinable.  That is, one can copy/paste a chunk of code, hit a
> >>> key and suddenly everything is nicely indented.
> >> Cool, so in other languages I need to set block marks like () and {}
> >> and also indent the code for readability, and in Python I indent
> >> only. From my POV that's less work.
> >
> > Try reading again. In Lisp, you use () and *your editor* automatically
> > indents according to the universal standard, or you leave it sloppy
> > until other folks reading your code convince you to get a proper
> > programming editor. Indentation does not get out of sync with semantics
> > because the editor virtually never misses parentheses that the Lisp
> > compiler sees. Expressions keep the same meaning even if you have to
> > start breaking them across lines, etc.
> >
> > In Python, you group in your mind, and press indentation keys to make
> > it happen in your editor. The editor cannot help that much, because it
> > cannot read your mind. White space screwups in copy-paste cannot be
> > fixed by the editor automatically, because it cannot read the original
> > programmer's mind, and you have to fix it manually, and risk screwing
> > it up.
>
> Call us when you have an editor that reads your mind and writes the ()
> for you.

This is an irrelevancy. Typos that drop printing characters in either
language will generally cause changes to the semantics. Lisp
programmers, incidentally, will see that their editor indented things
in a funky way and recognize "hey, I dropped a paren somewhere in that
copy-paste." (And, if so, it is usually at the end, and can be
recovered using automatic matching when typing the ')' ). And,
honestly, the punctuation is no harder to type in Lisp than in other
languages, they just occur in different (and more consistent) places.

The point of Python is that changing white-space to
different-white-space changes the semantics. At best an editor can
notice "hey, funky white-space here, please correct" as IDLE did when I
wrote my first Python in a non-Python-aware editor, and somehow had
swapped tabs and spaces; when I moved it to IDLE---the indentation
*looked fine* but was invisibly weird. At worst, an editor can go
"sure, I'll let you change your program."

I'm not saying the worst case is typical. The annoying case is more
likely. I will even admit that white-space significance does not
materially increase errors among experienced Pythonistas. What it isn't
is some kind of miraculous invention that saves programmers from ever
making mistakes that are common in other languages, or that reduces
effort in copy-paste, as Bjoern seemed to be claiming.




More information about the Python-list mailing list