Python syntax in Lisp and Scheme

Terry Reedy tjreedy at udel.edu
Sat Oct 4 23:36:22 EDT 2003


"Grzegorz ChrupaÅ,a" <grzegorz at pithekos.net> wrote in message
news:bln1uh$9ti$1 at news.ya.com...
> As an example of how subjective this can be, most of the features
you
> mention as too complex for Python to support are in fact standard in
Scheme
> (true lexical scope, implicit return, no expression/statement
distinction)

> Another problem with simplicity is that introducing it in one place
may
> increase complexity in another place. [typos corrected]

[Python simplicity=>complexity example (scopes) snipped]

[I am leaving the reduced newsgroup list as is.  If anything I write
below about Lisp does not apply to Scheme specificly, my aplogies in
advance.]

There is a basic Lisp example that some Lispers tend to gloss over, I
think to the ultimate detriment of promoting that more people
understand and possibly use Lisp (in whatever version).

Specifically, the syntactic simplification of unifying functions and
statements as S-expressions aids, is made possible by, and comes at
the cost of semantic complexification of the meaning of 'function
call' (or S-expression evaulation).

The 'standard' meaning in the languages I am previously familiar with
(and remember) is simple and uniform: evaluate the argument
expressions and somehow 'pass' the resulting values to the function to
be matched with the formal parameters.  The only complication is in
the 'how' of the passing.

Lisp (and possibly other languages I am not familiar with) adds the
alternative of *not* evaluating arguments but instead passing them as
unevaluated expressions.  In other words, arguments may be
*implicitly* quoted.  Since, unlike as in Python, there is no
alternate syntax to flag the alternate argument protocol, one must, as
far as I know, memorize/learn the behavior for each function.  The
syntactic unification masks but does not lessen the semantic
divergence.  For me, it made learning Lisp (as far as I have gotten)
more complicated, not less, especially before I  'got' what going on.

In Python, one must explicitly quote syntactic function arguments
either with quote marks (for later possible eval()ing) or 'lambda :'
(for later possible calling).  Inplicit quoting requires the alternate
syntax of either operator notation ('and' and 'or'-- but these are
exceptional  for operators) or a statement.   Most Python statements
implicitly quote at least part of the construct.  (A print statement
implicitly stringifies its object values, but this too is special
handling.)

Question: Python has the simplicity of one unified assignment
statement for the binding of names, attributes, slot and slices, and
multiples thereof.  Some Lisps have the complexity of different
functions for different types of targets: set, setq, putprop, etc.
What about Scheme ;-?

Terry J. Reedy






More information about the Python-list mailing list