At 00:47 07.03.01 +0900, Dave Thomas wrote: >Tammo Freese <tammo.freese / offis.de> writes: > >> Can you tell me how to figure out the result of the following code >> easily without looking at variable a and without thinking about >> the hashing strategy? > >No, because hashes are unordered. > >> Or is the morale that I should not invert hashes with equal values >> because the results are too difficult to predict? > >I guess it depends on the result you want. There are circumstances >where inverting a hash is a useful thing to be able to to, and others >where it might not make too much sense. You'll need to make a decision >based on your own application. Is there any case where inverting a hash that is not one-to-one makes sense? (You cannot know the result!) If not, wouldn't it be more convenient to throw an exception when someone is trying to invert such a hash? - Tammo Freese freese / acm.org