On 4/29/2012 3:57 AM, John O'Hagan wrote:
How do function objects fit into this scheme? They have __hash__, __eq__, seem to work as dict keys and are mutable. Is it because their hash value doesn't change?
I suspect functions use the default equality and hash based on id, which does not change.
Under what circumstances does an object's hash value change?
When someone has written a buggy .__hash__ method. Or perhaps if someone is making a non-standard, non-dict use of hash().
-- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list