By value or by reference?

Josiah Carlson jcarlson at
Mon Oct 18 20:02:23 CEST 2004

> 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.

It is because Python does it differently from most other languages, and
it doesn't fit the paradigms of "pass by value" or "pass by reference"
as already explained by Alex Martelli.

Python does name binding with references.  That is, each reference is
given a name, but you cannot change data by assigning to a name; you can
only change what data that name points to.  There are certain operations
that can be done with mutable objects and immutable objects, but that is
another discussion entirely.

There is not so much an argument, but there is a semantic "what the hell
is it doing" that is not being communicated properly.  I am sure there
is a FAQ about this, but I don't have the link handy, and I can't quite
find the right incantation for Google.

 - Josiah

More information about the Python-list mailing list