On Sun, Aug 11, 2013 at 5:04 AM, Joshua Landau <jos...@landau.ws> wrote: > On 11 August 2013 04:43, Chris Angelico <ros...@gmail.com> wrote: >> The >> distinction between the two is important when the objects are mutable >> (so they have an identity that's distinct from their current values). > > I don't follow this argument. Tuples are immutable yet you're crazy if > you check their equality with "is". In Python identity and equality > are very distinct.
True, it's not strictly an issue of mutability of that one level. But anything that's truly immutable (a tuple/frozenset of ints/strings) can in theory be interned. In some languages (no Pythons as far as I'm aware, though one could easily do so and still be fully compliant), all strings are automatically interned, so there's no difference between value and identity for them. A tuple containing a list, for instance, needs its identity; a tuple of three integers is identifiable entirely by its value. ChrisA -- http://mail.python.org/mailman/listinfo/python-list