Python's Lisp heritage

James J. Besemer jb at cascade-sys.com
Fri Apr 26 13:04:27 EDT 2002


Jacek Generowicz wrote:

> No, as Paul said, they are used for "function calls". Admittedly, in
> mathematical expressions function call often coincide with
> sub-expressions, but it does depend on the sub-expression in
> question.

Thanks for the clarification.  Now I get it.

> Compare
>
>    (+ 1 2 3 4 5 6 7 8 9 10)
>
> with
>
>    1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10
>
> Gosh, what a lot of typing I have to do in Python, compared to lisp.

So that begs the question: is it more common to have lengthy "sub expressions"
like your example or is my example with a mixture of operations more typical?

Now we're down the realm of statistics, which means it'll never be resolved.
(I shoulda seen that one comin'.)

> But, if you are
> dealing with mathematical expressions, then, obviously, you will use
> some sort of infix notation macro:

I am not familiar with Common Lisp and did not know that was common.  Though I
suppose I should have guessed that anything's possible.

> Incidentally, it would be interesting to see how many people would
> correctly work out in their heads (on first attempt) what 1+2*3/4-5
> evaluates to (leaving aside the fact that in Python it evaluates to
> -3[*]) . . . and then compare it to the success rate when considering
> the equivalent (+ 1 (/ (* 2 3) 4) -5). Or maybe how long it takes them
> to get the right answer in each case.

Hard to say.  Do the survey and lemme know.

Then too, this is a simple example and it seems the big trick in either case is
in knowing how divide works.

In Python's case it's truly a trick question as there presently is absolutely
no way to predict what the result will be without several bits of additional
information.  (I came late to the argument, but personally I think so called
"true division" is/was a big mistake.)

Then too, the results probably vary among Lisp implementations, so you'd have
to be more specific in that case too.  IIRC, some systems were integer only,
some were real only and some had both numeric types.  I dunno what's standard
these days.

So I guess the "trick" parts of the question would far outweigh any data about
infix vs. postfix.

> > > I'd expect Lisp syntax to be
> > > rather less error-prone, if anything, since it's much simpler
> >
> > I think that's debatable.  Certainly simplicity makes it easier to
> > learn, so that's a plus.  But it's still very tedious to get all the
> > parentheses matched up just right.
>
> It seems that many (most?) people who actually try to write lisp
> without making a big issue of the parentheses, very rapidly come to a
> conclusion that disagrees with yours.

1. I think that's a fair statement.  Earlier in the week, someone suggested I'd
be more happy with Python after I was "reprogrammed" to think "Pythonically"
(which sounds like something L. Ron Hubbard would say.)  I understand that
after a period of adjustment, people can function normally while wearing
glasses that flip their entire field of vision upside down.  It takes a few
days to adjust after putting them on and another couple days to adjust after
taking them off.  So, although I can't disagree with your statement (people
adapt), I don't think it's a very strong point.  Humans are adept at overcoming
much more severe handicaps.

2. We can speculate and rationalize all day but without knowing the actual
error statistics, productivity numbers, etc., we're just airing opinions and
assertions.

3. I'm personally conflicted in the matter because when I was doing a lot of
lisp programming I DID come to appreciate that the syntax was not a huge
problem.  You get used to it and in some ways it's kind of nice.

4. The point I've been trying to make is that the syntax is enough of a
departure from most peoples' training that it constitutes a genuine barrier to
entry.  Peoples' common objections may be superstitious and unfounded in the
long run but it does require a period of adjustment and retraining (thus it
costs).   And whether they're better or worse off in the long run I still
maintain is "debatable."

5. Finally, I think the problem here is that we're all making passionate,
definitive statements about items that ultimately really boil down to matters
of personal preference.  And there's no accounting for taste.

Thanks for the clarifications and for taking the time to reply.

REgards

--jb

--
James J. Besemer  503-280-0838 voice
http://cascade-sys.com  503-280-0375 fax
mailto:jb at cascade-sys.com







More information about the Python-list mailing list