mutable sequences

Jim Lee jlee54 at gmail.com
Wed Jun 13 23:52:27 EDT 2018



On 06/13/2018 07:56 PM, Sharan Basappa wrote:
> The term mutable appears quite often in Python.
> Can anyone explain what is meant by mutable and immutable sequences.
Mutable means changeable, and immutible means not mutable, or unchangeable.
> For example, Python lists are mutable.
>
> BTW, is the below explanation correct (it is taken from a book I am reading)
>
> Python lists are mutable sequences. They are very similar to tuples, but they
> don't have the restrictions due to immutability.
>
> It says lists are mutable and then says they are immutable???
>
   You have come across a pet-peeve of mine.  The current crop of 
technical books are categorically inferior to those published in the 
past.   There seems to be little to no proofreading involved before 
publication, and the authors' grammar is no better than what we see in 
casual, off-the-cuff email.  You have shown us a prime example of 
email-speak being published as a finished work.  The author states (if 
one assumes that his grammar is correct) that immutability is what gives 
lists an advantage over tuples.  This is simply wrong due to poor 
grammar.   What the author *intended* to say is that lists don't suffer 
from the restrictions placed on tuples - i.e. immutability.  In other 
words, lists are mutable, tuples are immutable.  Try to find a better 
book - which is difficult to do these days.

-Jim





More information about the Python-list mailing list