Python syntax in Lisp and Scheme

Terry Reedy tjreedy at udel.edu
Tue Oct 14 14:15:00 EDT 2003


"Hartmann Schaffer" <hs at heaven.nirvananet> wrote in message
news:3f8c24c6 at news.sentex.net...
> In article <6mWdnVM6bOIOiRGiU-KYhA at comcast.com>,
> "Terry Reedy" <tjreedy at udel.edu> writes:
> > For float constants in a language (such as Fortran) with multiple
> > float types (of different precisions), naming as part of a
declaration
> > of precision is (or at least has been) a standard practice in some
> > circles.  It makes it easy to change the precision used throughout
a
> > program.
>
> this is a good practice when the literals are parameters that you
want
> to change occasionally.  other reasons why you want to do that is
that
> typing certain constants (e.g. pi or e) is error prone, so writing
> them down once and binding them to a (descriptive) name is
preferrably
> to having to type them repeatedly.  but unless they play a parameter
> role, binding short literals to name doesn't serve any purpose

My last sentence above gives a purpose, which is *the* purpose which
lead the editors of Applied Statistics to 'strongly advise' (up to
1985 at least, don't know about today) algorithm authors to "denote
all REAL constants symbolically" (A. S. Algorithms, p. 30).  I'm just
reporting, not advocating.  This in not an issue for standard Python,
which only allows access to C doubles.

> >> [Mind you, Python's lambda is next to useless anyway]
> >
> > It is quite useful for its designed purpose, which is to
abbreviate
> > and place inline short one-use function definitions of the
following
> > pattern: def _(*params): return <expression using params>.
>
> the last version of python i used was 1.5.x, and then the absence of
> closures made the anonymous functions pretty useless

The default-parameter hack which substituted for closures made lambdas
then more awkward, but I believe they were mostly just as useful as
today as callbacks and as HOF args.  In any case, closures were
introduced over two years ago in 2.1, and your original statement says
'is', not 'used to be some years ago'.

Terry J. Reedy






More information about the Python-list mailing list