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

Andrew Koenig ark at research.att.com
Fri Oct 18 15:41:38 EDT 2002


Thorsten> This relies on two assumptions:

Thorsten> 1. repr(x) == repr(y) <=> x == y

Thorsten> 2. eval(repr(x)) == x (for further processing)

Thorsten> Does anyone know under which circumstances 1. and 2. are
Thorsten> wrong?

1. is not true for x==3, y==3.0, because x==y and repr(x)!=repr(y).

2. is not true for x==repr, because eval(repr(repr)) raises SyntaxError.

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark



More information about the Python-list mailing list