By value or by reference?

JCM joshway_without_spam at myway.com
Mon Oct 18 13:41:44 EDT 2004


Michael Hoffman <m.h.3.9.1.without.dots.at.cam.ac.uk at example.com> wrote:
...
> With pass-by-value, the memory location of a would be different than the 
> memory location of i. However, since Python is pass-by-reference, it 
> remains the same. <wink>

The memory location of the object is the same; the memory location of
the reference is different.

> Alex is right that trying to shoehorn Python into a "pass-by-reference" 
> or "pass-by-value" paradigm is misleading and probably not very helpful. 
> In Python every variable assignment (even an assignment of a small 
> integer) is an assignment of a reference. Every function call involves 
> passing the values of those references.

I've given up expressing my opinion on the matter.  Everyone here
seems to have a different notion of what "pass-by-reference" and
"pass-by-value" mean.  It's funny--I've never run into trouble with
these terms before seeing these discussions on C.L.Py.



More information about the Python-list mailing list