You could try numpy.ndarray.flat, which represents an iterator that you can use for reading and writing into the array.
>>> M = zeros((4,4))
>>> M.flat[::5] = 1
>>> print(M)
array([[ 1., 0., 0., 0.],
[ 0., 1., 0., 0.],
[ 0., 0., 1., 0.],
[ 0., 0., 0., 1.]])
Note that in numpy the slicing syntax is [start:stop_exclusive:step], as opposed to Matlab's (start:step:stop_inclusive).
Based on sebergs comment it might be important to point out that Matlab stores matrices in column major, while numpy arrays are row major by default.
>>> M = zeros((4,4))
>>> M.flat[:4] = 1
>>> print(M)
array([[ 1., 1., 1., 1.],
[ 0., 0., 0., 0.],
[ 0., 0., 0., 0.],
[ 0., 0., 0., 0.]])
To get Matlab-like indexing on the flattened array you will need to flatten the transposed array:
>>> M = zeros((4,4))
>>> M.T.flat[:4] = 1
>>> print(M)
array([[ 1., 0., 0., 0.],
[ 1., 0., 0., 0.],
[ 1., 0., 0., 0.],
[ 1., 0., 0., 0.]])
arr.flatattribute.