Isn't the difference between 2D and ND: zeros((X, 2)) vs. zeros((X, N))? So, you could use Py_ssize_t[:, :] for all types of dimensionalities?