__eq__ and sets

Erik Max Francis max at alcyone.com
Tue Feb 25 17:17:33 EST 2003


Rene Pijlman wrote:

> This is indeed what Python 2.2 returns on uncomparable type
> combinations:
> 
> >>> 2  == "foo"
> 0
> >>> 2 == [2,3]
> 0
> >>> [2,3] == {2:"foo", 3:"bar"}
> 0

Well, usually:

>>> 2+1j < 1+2j
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: cannot compare complex numbers using <, <=, >, >=
>>> 1 < 1+0j 
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: cannot compare complex numbers using <, <=, >, >=


-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Grub first, then ethics.
\__/ Bertolt Brecht
    Polly Wanna Cracka? / http://www.pollywannacracka.com/
 The Internet resource for interracial relationships.




More information about the Python-list mailing list