repr(x) == repr(y) <=> x == y AND eval(repr(x)) == x
Thorsten Kampe
thorsten at thorstenkampe.de
Fri Oct 18 15:09:47 EDT 2002
More information about the Python-list mailing list
Fri Oct 18 15:09:47 EDT 2002
- Previous message (by thread): repr(x) == repr(y) <=> x == y AND eval(repr(x)) == x
- Next message (by thread): repr(x) == repr(y) <=> x == y AND eval(repr(x)) == x
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, I'm using dictionaries for some "very generalized programs". This means that I cannot tell in advance if all the items I'm operating on are hashable. The "trick" that came to my mind was to use repr(x) as the key (instead of x). This relies on two assumptions: 1. repr(x) == repr(y) <=> x == y 2. eval(repr(x)) == x (for further processing) A wise man once said to me: ,--- | You're FAR more likely to meet objects where you can't count on | eval(repr(x)) == x, than non-hashable objects. `--- Does anyone know under which circumstances 1. and 2. are wrong? Thorsten
- Previous message (by thread): repr(x) == repr(y) <=> x == y AND eval(repr(x)) == x
- Next message (by thread): repr(x) == repr(y) <=> x == y AND eval(repr(x)) == x
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list