Finding the instance reference of an object

Hendrik van Rooyen mail at microcorp.co.za
Tue Nov 4 14:57:24 EST 2008


 "Joe Strout" <joe at strout.net> wrote:


> 4. You now see how a mutating an object within a function tells you
> NOTHING about how the reference to that object was passed.

> 5. You see that the first three languages above are passing a
> reference by value and using that to mutate and object, yet for
> reasons still mysterious, the Python example (which has exactly the
> same behavior) must be doing something different.

This is dialectic nit picking - WTF makes "passing a reference by value"
different from "passing a reference" - the salient point is that its a reference
that is passed - would you expect another level of indirection - a reference to
the
reference, or what, before you admit that the thing that is passed is a
reference
and not a copied value of the OBJECT that is of interest.

Looks to me that even if there were ten levels of indirection you would still
insist that its a "pass by value" because in the end, its the actual memory
address of the first pointer in the queue that is passed.  If that is what you
mean,
it is obviously trivially true - but then ALL calling can only be described as
"call by value" - which makes nonsense of what the CS people have been
doing all these years.

"Calling by value" is not a useful definition of Pythons behaviour.

- Hendrik






More information about the Python-list mailing list