Saturday, 7 September 2013

Why Use a=b in Python

Why Use a=b in Python

If I define
foo=[[1,2],[2,3],[3,4]]
bar=a
then foo and bar reference the same object, namely [[1,2],[2,3],[3,4]]. I
can now use either of these "tags/namespaces/references" to make changes
to the object [[1,2],[2,3],[3,4]], but how is this useful to anyone?

No comments:

Post a Comment