1 Resposta
+ 4
An implementation of Python has the freedom to let several immutable equal objects be just one object; but for mutable objects that is forbidden, they have to be separate objects.
Unless you explicitly (or maybe more often even mistakenly ^^) say, two different names should be one object, like:
a = [1, 2]
b = a
With an assignment, you basically just strip the name sticker off an object and stick it somewhere different. So with immutables, since you have no methods to change them, it doesn't matter.
When an object has methods to change, though, haphazardly melding them into one object can destroy data.