This document might be a nice inspiration for the distinction of mutable/immutable types, and how it relates to memory and making copies of objects.
To me (coming from R) it's easy to forget that the following code would result in a being changed:
a = [1, 2, 3]
b = a
b.append(4) # both a and b become [1, 2, 3, 4]
It might be worth flagging this up with an example/exercise, as it might cause people silent bugs if they come from another language.
This document might be a nice inspiration for the distinction of mutable/immutable types, and how it relates to memory and making copies of objects.
To me (coming from R) it's easy to forget that the following code would result in
abeing changed:It might be worth flagging this up with an example/exercise, as it might cause people silent bugs if they come from another language.