What is a function parameter =[] for?

Jussi Piitulainen harvest at should.be.invalid
Wed Nov 25 06:39:44 EST 2015


Antoon Pardon writes:

> Op 25-11-15 om 01:55 schreef Laura Creighton:

>> If I had a time machine, I would go back to early days of Python and
>> ban the use of the term 'assignment' and 'value' both.  I would
>> insist that the term 'binding' be used instead, though if you want to
>> use the verb refer, to be synonymous with bind, well, I think that
>> would work.  (If not, next trip with the time machine, I ban that one
>> as well.)  Then you make it perfectly clear that what are bound are
>> _objects_ not values (or evalues).  The object has an evalue, but it
>> is the object that is bound.
>
> Not far enough back. Since there are older languages with the same
> assignment semantics as python, you should at least go so far.

Back to 1958 or so when Lisp was LISP and the association of names with
whatever they named was represented as "association lists" (singly
linked lists of key-keyed pairs), or possibly as "property lists"
(singly linked lists with alternative elements being the key and the
keyed). Other arrangements are known. Such a list would have the role
that namespaces have in Python. One could replace the named thing. Then
the name would be associated with something else when that same list
still served as the namespace.

This node (point b) in reminiscenses by John McCarthy himself refers to
the "pseudo-functions" rplaca and rplacd that can replace components of
these data structures (the "a" and "d" refer to the "address part" and
the "decrement part" of a register).
<http://www-formal.stanford.edu/jmc/history/lisp/node4.html>

In point d, McCarthy refers to variables as variables; I'm sure this
would go back to Church and 1940's at least, so I expect they used this
word already back then. But the ability to store new content to the data
structure that associates variables with stuff must be newer. I think it
was new with LISP.

I don't know if assignment was originally called assignment, or whether
the association of names with stuff was originally called binding, but
this terminology is old enough that I've known binding and assignment of
variables by these names for as long as I can remember, with more or
less the semantics that Python now uses. "Rebinding" I've not known
elsewhere.

> Otherwise you would get the argument why one shouldn't use the
> word assignment in python, while other languages use it for the
> same kind of thing.

I think the argument is just that: One shouldn't use otherwise standard
terminology in connection with Python. (With the possible exception of
the Python language reference.) Because people might be confused. (Other
people's confusion doesn't matter. And does the terminology ban even
help?) Also, C is different! (Only C matters. Because no reasons.)

That became snarky in the end. The trouble is that my mental model and
terminology serve me really well when I work in Python.



More information about the Python-list mailing list