How the subscripts of multi-dimensional arrays is coded in Python really does matter. The element (i,j) of a two-dimensional array can either be written as:
X[i][j] X[i, j]
Which is better? We took the naive box filter algorithm from the previous post, using each of these subscripting methods. The result:
X[i][j] - 84.19 sec X[i, j] - 72.15 sec
So X[i,j] = X[i][j], but X[i][j] is more inefficient because a new temporary array has to be created after the first index that is subsequently indexed by j.