It's easy to think of ndarray as an oval list s. Broadcast and array operations automatically apply to the lists involved in these operations, so you can add an array and a list of broadcast-compatible figures, and numpy will not try to combine the two (as it will try to do with two lists).
One huge (and for me, confusing) exception is fancy indexing . Unusual indexing is already confusing me (like someone from MATLAB), since it is strange that the following two give a different result:
import numpy as np A = np.random.rand(3,3) A[0:1,0:1] A[range(2),range(2)]
The first operation cuts and returns the submatrix 2 by 2. The latter refers to fancy indexing and returns only a 2-element array containing A[0,0] and A[1,1] .
Your question is related to something odd: lists and arrays of booleans behave differently when used in fantastic indexing. Consider the following two examples according to your question:
A = np.random.rand(4,2) bool_index_list = [False, True, True, False] bool_index_array = np.array(bool_index_list) A[bool_index_list].shape A[bool_index_array].shape
The former returns (4,2) , the latter (2,2) .
In the first case, since the index is list , Boolean values ββare converted to the corresponding integers, and the resulting values [0,1,1,0] are used as actual indices in the matrix, returning [first, second, second, first], respectively.
In the latter case, the index of array of dtype=bool used as you would expect it to be: it is used as a mask to ignore those rows A for which the index is False .
numpy release notes , among other things, indicate that
In the future, Boolean array-likes (e.g. python bools lists) will always be treated as logical indexes, and Boolean scalars (including python True ) will be legal logical index.
Accordingly, the list-based indexing examples above give me the following warning in numpy 1.10.1:
FutureWarning: in the future, boolean array-likes will be treated as an index of a boolean array
So, the short answer to your question is that it is legal, but not for long. Stick to ndarray phase-indexing and you should not experience any bumps along the way.