Array operation with boolean operator

bearophile bearophileHUGS at lycos.com
Thu Mar 14 11:41:24 PDT 2013


Andrea Fontana:

> I always think X < Y return a single bool,

Having a practice with NumPy and the like, I think X < Y as 
returning as many bools as the length of X and Y:

>>> from numpy import *
>>> a = array([1, 5, 1])
>>> b = array([1, 1, 5])
>>> a < b
array([False, False,  True], dtype=bool)


Programmers with experience of Matlab, Matcad, etc, feel the same.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list