Computing an md5 hash of a data structure
问题 I want to compute an md5 hash not of a string, but of an entire data structure. I understand the mechanics of a way to do this (dispatch on the type of the value, canonicalize dictionary key order and other randomness, recurse into sub-values, etc). But it seems like the kind of operation that would be generally useful, so I'm surprised I need to roll this myself. Is there some simpler way in Python to achieve this? UPDATE: pickle has been suggested, and it's a good idea, but pickling doesn't