Problem with assigning variables of type List

Donn Cave donn at u.washington.edu
Tue Aug 20 12:52:51 EDT 2002


Quoth Paul Foley <see at below>:
| On Tue, 20 Aug 2002 07:34:13 -0400, Peter Hansen wrote:
|> Nope.  Assignment works by rebinding the name to something else,
|> in effect changing the reference.  There is no pass by value in 
|> Python.  (Although somebody may still refute this successfully,
|> but I don't think you have so far.)
|
| Python is pass by value.  A lot of people seem to be confused about
| what that means.
|
| Click here: http://groups.google.com/groups?threadm=3222349504568437%40naggum.net

Hm, a thread where 4 correspondents offer the following opinions
about Common Lisp: "call by reference", "call by value", "call by
value but more like call by reference in C++", "pass by reference".
Sure enough, there is evidence of some confusion there.  It's clear
enough that they all understand what's happening, though, even if
they use different names for it.

| [And assignment doesn't have anything to do with binding, either, but
| that's another argument]
|
|> Maybe the issue is that these conventional terms do not apply
|> to Python as well as they do to more conventional languages...
|
| They apply just as well to Python as any other language.  There's
| nothing very unusual about Python.

True, but he's close.  If you try to include C, Pascal, et al., among
the conventional languages, you have too many different semantics to
cover with value/name/reference.  Call it what you want, but the shadow
of C and Pascal hangs over the discussion and will forever keep these
terms from being understood the way the Lisp authorities prescribe.

So you're right, they apply just as well to Python as any other language,
but that's because their application isn't governed by any absolute,
language-independent meaning, so we're free to apply them however it
suits us.  It would be better to adopt Tim Peters' proposal:

 ``I usually say Python does "call by object".  Then people go "hmm,
   what's that?".  If you say "call by XXX" instead, then the inevitable
   outcome is a tedious demonstration that it's not what *they* mean by
   XXX.  Instead I get to hear impassioned arguments that "by object"
   is what any normal person means by YYY <wink>.

 ``BTW, I believe Barbara Liskov first coined "call by object" to describe 
   argument-passing in CLU.''

(end quote.)

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list