In Python you can do the following;
>>> 3 < 4 < 5
True
>>> 3 < 4 < 4
False
How does this work? I would have thought that 4 < 5 would return a boolean, and so 3 < True should return False, or 3 < 4 should return a boolean and so True < 4 should maybe return True if True could be cast as an integer 1?.
And why doesn't it work for numpy arrays?
>>> 1 < np.array([1, 2, 3]) < 3
Traceback (most recent call last):
File "<input>", line 1, in <module>
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Could it be made to work for numpy arrays?