Tuples and immutability

Ian Kelly ian.g.kelly at gmail.com
Fri Mar 7 19:23:10 CET 2014

On Fri, Mar 7, 2014 at 4:51 AM, Alister <alister.ware at ntlworld.com> wrote:
> I would think it would be better if the exception was thrown before the
> assignment to the list took place
> simply seeing that a modification action was being applied to a tupple
> should be enough.
> this would alert the programmer to the fact that he was trying something
> that may have undesired consequences

Then the behavior of tuples would be inconsistent with other immutable
types.  This can't be applied generally, because the Python
interpreter doesn't generally know whether a given type is supposed to
be immutable or not.

More information about the Python-list mailing list