Explanation of list reference

Gregory Ewing greg.ewing at canterbury.ac.nz
Sat Feb 15 13:03:22 CET 2014


Jussi Piitulainen wrote:
> Would it help to say that in case 1 the relevant statement acts on the
> variable while in case 2 it acts on the value of the variable?

I would try to avoid using words like "value" and "variable",
because they don't have well-defined meanings in Python.

The way I would put it is that

    a = b

changes which object the name 'a' refers to, whereas

    a[i] = b

does not.

-- 
Greg



More information about the Python-list mailing list