I completely disagree. I have worked extensively both with Matlab and Numpy, and I much prefer Python's 0-based indexing and half-open intervals over Matlab's 1-based indexing and closed intervals. Edsger Dijkstra, the famous computer scientist, explained why this is a good idea
. E.g. splitting the first n
items off an array in Matlab is head = x(1:n); tail = x(n+1:end)
, while in Python it is head = x[:n]; tail = x[n:]
. Even worse is when doing some computation over blocks within an array, in Matlab you do for i=1:n; y(i) = fun(x((i-1)*m+1:i*m)); end
, while in Python it is for i in range(n): y[i] = fun(x[i*m:i*m+m])
. In Matlab, you always have to think careful about the extra +-1, which causes many off-by-one errors, while in Python you just write it down intuitively.