Clarification on Immutability please
Oh dear, I am sorry. I have created quite a storm.
Moreover, I am sorry because I misremembered what I had typed into Idle. My
original tuple only had two elements, not three, so the slicing [:2] didn't
affect the tuple at all - and so the second id() gave the same address as
the first one.
So, yes, I am stupid - or just having senior moments (I am 65, after all).
On Wed, Jan 22, 2020 at 4:30 AM Michael Torrie <torriem at gmail.com> wrote:
> On 1/21/20 6:52 PM, Ethan Furman wrote:
> > On 01/21/2020 10:55 AM, Michael Torrie wrote:
> >> Slicing
> >> returns a new object whether one is slicing a tuple, list, or a string,
> >> the latter two are mutable objects.
> > Strings are not mutable.
> Yup I got my items in the wrong order. I meant to say list, tuple, or a
> string, the latter two are immutable objects. Thanks for correcting me.