There are also the rich comparison methods, such as __lt__, __eq__ etc. that typically return a bool. I don't think it's useful to return a bool, but we could return a new Array of bools:
>>> a = Array('uint8', [5, 10, 20, 100])
>>> a < 15
Array('bool', [True, True, False, False])
>>> a == 20
Array('bool', [False, False, True, False])
One I missed was unary minus (
__neg__
), which makes sense for Arrays of int or float-like types. Also should support unary plus, and abs.There are also the rich comparison methods, such as
__lt__
,__eq__
etc. that typically return a bool. I don't think it's useful to return a bool, but we could return a new Array of bools: