Steven D'Aprano <st...@pearwood.info>:

> Making tuples mutable would break their use as dictionary keys, which is a
> *critical* use.

No, it wouldn't. Any object that provides __hash__() and __eq__() can be
used as a key.

Nothing prevents using mutable objects as keys in Python.

    Egon Spengler: There's something very important I forgot to tell you.
    Peter Venkman: What?
    Spengler: Don't use mutable keys.
    Venkman: Why?
    Spengler: It would be bad.
    Venkman: I'm fuzzy on the whole good/bad thing. What do you mean,
       "bad"?
    Spengler: Try to imagine all life as you know it stopping
        instantaneously and every molecule in your body exploding at the
        speed of light.
    Ray Stantz: Total protonic reversal!
    Venkman: Right. That's bad. Okay. All right. Important safety tip.
        Thanks, Egon.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to