Reference Variables In Python Like Those In PHP

Fredrik Lundh fredrik at pythonware.com
Tue Aug 15 17:44:20 EDT 2006


Luke Plant wrote:

> You should note that, to a nearest equivalent, all variables are
> reference variables in Python.  The difference is in what assignment
> does -   += in Python does an assignment of a new object for immutable
> objects.  For mutable objects like lists, += does an in place
> modification.

that depends on the object implementation, though -- the "+=" statement 
does not, in itself, distinguish between mutable and immutable objects.

</F>




More information about the Python-list mailing list