Peter Otten wrote:

So, precisely, you mean that if hash(a) != hash(b), a and b are
considered distinct, and else [ie. if hash(a) == hash(b)], a and b are
the same if and only if a == b ?

Correct for set, dict. For lists etc. the hash doesn't matter:

Since CPython saves strings hashes as part of the string object (last I read, as part of internal string caching), it does something similar. Compare lengths, then hashes, then C array.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to