repr(x) == repr(y) <=> x == y AND eval(repr(x)) == x

Chad Netzer cnetzer at mail.arc.nasa.gov
Fri Oct 18 15:56:00 EDT 2002


On Friday 18 October 2002 12:30, Erik Max Francis wrote:

> If you're interested in whether or not the objects are hashable, why not
> just try calculating their hashes, and then handle the error should one
> happen?

Furthermore, a straightforward trick is to wrap your object in a single 
element tuple, and use that as the key.  It is a much *MUCH* better solution 
than monkeying with 'eval( repr( x ) )'.

-- 

Chad Netzer
cnetzer at mail.arc.nasa.gov




More information about the Python-list mailing list