Finding the instance reference of an object

greg greg at cosc.canterbury.ac.nz
Sat Nov 8 01:21:56 EST 2008


Arnaud Delobelle wrote:

> 'Pass by value' is not relevant to Python as variables do not contain
> anything.

Where abouts in the phrase "pass by value" does the word
"contain" appear?

You don't need a notion of containment in order for
"pass by value" to have meaning. All you need is some
notion of a "value" (it doesn't matter what) and
some way to "pass" that value.

> 'Pass by reference' is not relevant to Python as the language
> doesn't have the concept of object reference (in the sense of e.g. C++
> reference).

What it doesn't have is the concept of a *variable*
reference, which is what the "reference" in "pass by
reference" means.

> Here lies, IMHO, the reason why you think you need Python to 'pass by
> value'.  As you believe that variables must contain something, you think
> that assignment is about copying the content of a variable.  Assignment
> in Python is simply giving a new name to an object.

Yes, and so is passing by value!

-- 
Greg



More information about the Python-list mailing list