I am wondering what the practical reason there is for the observed behavior in python 2.7:
import hashlib
hashlib.md5('foo') == hashlib.md5('foo')
Returns false. But...
import hashlib
hashlib.md5('foo').hexdigest() == hashlib.md5('foo').hexdigest()
Returns true. I understand that the hexdigest/digest return the final string representations, but since the same data has been entered into the two hash objects directly, shouldn't they evaluate as equal to one another? Wouldn't the md5 HASH
object be aware of the internal identity when the magic __eq__
methods are called? For what reason would the objects themselves evaluate inequality? Really just curious.