Question about Pass-by-object-reference?
steve+comp.lang.python at pearwood.info
Wed Jul 23 03:56:48 CEST 2014
On Tue, 22 Jul 2014 12:04:09 -0700, fl wrote:
> I learn Python function call on tutorial. There is a link on this
> Although it explains clearly, the figure makes me puzzled.
Here is my take on the same question:
Feedback is welcome.
> ""Python is different. As we know, in Python, "Object references are
> passed by value".
I'm not sure who said that, but they weren't really being clear. The
mention of "passed by value" is pointless, since it refers only to the
implementation inside the interpreter, and not anything you can see using
Python code. What it means is that under the hood, you have a mysterious
thing called an "object reference". That's just another way of saying
"reference to an object", which is usually implemented as a pointer. When
the interpreter passes an argument to a function, it does so by making a
copy of that pointer (hence "passed by value"). The copy still points to
the same object.
I believe that for people thinking at the level of *Python code*, such
descriptions aimed at the level of the underlying C code inside the
interpreter add heat but no light. They simply cause more confusion than
More information about the Python-list