Tuples and immutability

Chris Angelico rosuav at gmail.com
Fri Mar 7 06:11:13 EST 2014


On Fri, Mar 7, 2014 at 8:33 PM, 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?

It'd be easy enough to implement your own tuple subclass that behaves
that way. Try it! See how many situations it actually helps.

ChrisA



More information about the Python-list mailing list