Tuples and immutability
roy at panix.com
Fri Mar 7 14:37:52 CET 2014
In article <XnsA2E95FA1E1EB6duncanbooth at 127.0.0.1>,
Duncan Booth <duncan.booth at invalid.invalid> wrote:
> Is there any reason why tuples need to throw an exception on assigning to
> the element if the old value and new value are the same object?
> If I say:
> a = ("spam", [10, 30], "eggs")
> a = a
> won't actually mutate the object. So tuples could let that silently pass.
But, why would you want them to? What a way to introduce bugs which are
difficult to test for.
More information about the Python-list