I never really got python slices before now.
I read http://docs.python.org/2/library/functions.html#slice and http://docs.python.org/2/library/itertools.html#itertools.islice. These 3 examples all make a hole
in a np.zeros((10,10)) grid:
grid = np.zeros((10,10)) grid[slice(2,5), slice(3,7)] = 1 # is equivalent to: grid = np.zeros((10,10)) for y in range(3,7): grid[slice(2, 5), y] = 1 # and also: grid = np.zeros((10,10)) for x in xrange(2,5): for y in xrange(3,7): grid[x][y] = 1