Finding the instance reference of an object

greg greg at cosc.canterbury.ac.nz
Tue Nov 11 18:47:04 EST 2008


Steven D'Aprano wrote:

> If you equate "arguments within the called procedure" to the *name* of 
> the arguments, then changing the arguments would mean changing the NAME

If "changing the name" means "rebinding the name",
then I agree -- that's exactly the point I was trying to
make.

> If you equate "value" with "object", as you suggested some posts ago, 

*I* didn't suggest that, someone else did. I was just
pointing out that you can use the word that way if you
want, as long as you're consistent about it. And being
consistent means using it in the same way when talking
about assignment and about by-value parameter passing.
If you insist that one of these implies copying the
"value" but the other doesn't, then you're being
inconsistent.

> At least some sections of the Java community seem to prefer a misleading 
> and confusing use of the word "value" over clarity and simplicity, but I 
> for one do not agree with them.

I don't see anything inherently confusing or misleading
about it. Confusion only arises when some people jump up
and say that it's wrong to use the terms that way, because
it might cause confusion...

> In the general case, you can't emulate call-by-reference by passing a 
> name, because you don't know what the name of an object is.

That's true, you need to communicate the namespace as
well, either implicitly or explicitly. So a
(namespace, name) pair, or a (sequence, index) pair
in the case of a sequence item, would be the equivalent
of a "reference" in the sense meant by "call by reference".

--
Greg




More information about the Python-list mailing list