How to determine if something is hashable?
apost at cbmi.upmc.edu
Mon Jun 25 19:48:55 CEST 2001
I want to write a function that takes a list of keys and a list of
values and returns a hash. I want to test, however, that all of the
items in the list of keys are hashable. How do I do this? The only way
that I've come up with so far is to do:
myDict[ keyList[ i ] ] = valList[ i ]
print keyList[ i ], 'is not hashable'
TypeError isn't specific to finding a non-hashable key, though, right?
More information about the Python-list