git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Clarification on Immutability please


On 1/21/20 11:38 AM, Chris Angelico wrote:
> Are you sure that it does? I can't reproduce this. When you slice the
> first two from a tuple, you create a new tuple, and until the
> assignment happens, both the new one and the original coexist, which
> means they MUST have unique IDs.

And furthermore this has nothing to do with immutability. Slicing
returns a new object whether one is slicing a tuple, list, or a string,
the latter two are mutable objects.