Why does:
[3] == np.arange(10)
return:
([False, False, False, True, False, False, False, False, False, False], dtype=bool)
Instead of simply False?
Why does np.arange(10)+3 return an array? The comparison [3] == np.arange(10) is treating the arguments in the same way, element by element (with broadcasting as needed).
If it can't broadcast and do element wise comparison it does return a False or an error.
In [285]: np.arange(10)==[1,2]
/usr/local/bin/ipython3:1: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.
#!/usr/bin/python3
Out[285]: False