Problem with assigning variables of type List
Fredrik Lundh
fredrik at pythonware.com
Tue Aug 20 12:41:01 EDT 2002
Peter Hansen wrote:
> > if it were passed by reference, you'd see [42] on the last line.
>
> 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.)
Paul uses his own dictionary of computing terms, and can thus
prove or refute anything he wants.
(Almost every time a "words mean what I say they mean" poster
appears in c.l.py, it's some kiwi bloke behind the keyboard. Is
Humpty Dumpty some kind of national hero in New Zealand?)
> Maybe the issue is that these conventional terms do not apply
> to Python as well as they do to more conventional languages...
The conventional terms work just fine for Python, if you use them
in the conventional way (e.g. see FOLDOC). I'm sure Paul knows
that too. He just cannot help himself.
(Paul uses the term "value" to mean what most other people, in-
cluding FOLDOC, would call a "reference". After all, on some level
really close to the CPU, the references you pass around are no
different from other values. To quote a more enlightened new
zealander:
... you have to say something like "the object referred to
by x is passed by reference". Or alternatively, "x is passed
by value, and that value is a reference to an object". Just
calling it "pass by reference" or "pass by value" are both
half true and half false.
</F>
More information about the Python-list
mailing list