Problem with assigning variables of type List
Hans Nowak
wurmy at earthlink.net
Wed Aug 21 07:38:08 EDT 2002
Paul Foley wrote:
[me]
>>I guess one could argue that the "value" passed here is an object, in this case
>>the list object, and the identity of that object cannot be changed by the
>>function in such a way that the caller ends up with a different object. The
>>id() of list a in the example is the same before and after the call.
>
> Exactly.
>
>>However, by that line of reasoning, C doesn't have call by reference either:
>
> Correct; C doesn't have call by reference. (C++ does, though)
> C doesn't do call by reference. You can manually construct pointers
> to values, if you have something to point at (i.e., you can't make a
> pointer to a literal, or the result of an equation or function call,
> without involving a variable), but it's still call by value of the
> pointer (when you pass &a for some variable a, you're not passing "the
> address of the argument variable"; the argument is &a, not a. You're
> passing the _value_ of &a -- which is the address of a, but that's
> utterly beside the point)
OK, so much like in that Lisp thread, we agree about what's going on under the
covers, we just don't agree about the name.
I guess Tim Peters was right by calling it "call by object" to prevent, or at
least delay, arguments like these. :-)
--
Hans (base64.decodestring('d3VybXlAZWFydGhsaW5rLm5ldA=='))
# decode for email address ;-)
The Pythonic Quarter:: http://www.awaretek.com/nowak/
Kaa:: http://www.angelfire.com/jazz/aquila/blog/blogger.html
More information about the Python-list
mailing list