[Tutor] Making Doubly Linked List with Less Lines of Code.

Alex Kleider akleider at sonic.net
Fri Jan 2 18:57:29 CET 2015


On 2015-01-01 17:35, Alan Gauld wrote:

> Repeats replicates the reference to the object but
> does not create a new object.

This part I can understand but, as Steven has pointed out,
this behaviour changes if the object being repeated is immutable.
Why would one get a new object (rather than a new reference to it)
just because it is immutable?  It's this difference in behaviour
that depends on mutability that I still don't understand even though
Steven did try to explain it to me:
"""
If the list items are immutable, like ints or strings, the difference
doesn't matter. You can't modify immutable objects in-place, so you
never notice any difference between copying them or not.
"""




More information about the Tutor mailing list