> But I'd say that it's not intuitive that for sets x in y can be false > (without raising an exception!) while the doing the same with a tuple > raises an exception. Where is this difference documented?
2.3.7 Set Types -- set, frozenset ... Set elements are like dictionary keys; they need to define both __hash__ and __eq__ methods. ... And it has to hold that a == b => hash(a) == hash(b) but NOT hash(a) == hash(b) => a == b Thus if the hashes vary, the set doesn't bother to actually compare the values. Diez -- http://mail.python.org/mailman/listinfo/python-list