Why are tuples immutable?

Paul Rubin http
Thu Dec 16 04:55:14 EST 2004


Antoon Pardon <apardon at forel.vub.ac.be> writes:
> Two guidelines can make it easier for a programmer to do this.
> 
> 1) Put a copy in the dictionary, so that mutating the original
>    object won't affect what is in the dictonary.

What's supposed to happen here?

    a = [1,2,3]
    d[a] = 9
    a.append(4)
    print d[a]

It doesn't sound like good dictionary semantics to me.



More information about the Python-list mailing list