Rasmus Fogh wrote:

Current behaviour is both inconsistent and counterintuitive, as these
examples show.

x = float('NaN')
x == x
False

Blame IEEE for that one. Rich comparisons have nothing to do with that one.

ll = [x]
x in ll
True
x == ll[0]
False

import numpy
y = numpy.zeros((3,))
y
array([ 0.,  0.,  0.])
bool(y==y)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()
ll1 = [y,1]
y in ll1
True
ll2 = [1,y]
y in ll2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()

Can anybody see a way this could be fixed (please)? I may well have to
live with it, but I would really prefer not to.

Make a concrete proposal for fixing it that does not break backwards 
compatibility.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to