Long integer shape of Numpy arrays

2020-04-11 08:29发布

问题:

If I construct a numpy matrix like this:

A = array([[1,2,3],[4,5,6]])

and then type A.shape I get the result:

(2L, 3L)

Why am I getting a shape with the format long?

I can restart everything and I still have the same problem. And as far as I can see, it is only when I construct arrays I have this problem, otherwise I get short (regular) integers.

回答1:

As @CédricJulien puts it on the comment, there is no problem with long numbers in this case - this should be treated as an implementation detail.

The real answer for your question can, of course, only be found inside numpy's source code, but the fact that the dimensions are long in this case should not matter for any use you have for the arrays or these indexes.