This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ningyidu
Recipients ningyidu, peter.otten
Date 2020-03-06.02:25:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAFGvHE66fa839YVOePsn2YvdxrbWzk0pCyX=Gs8Ns1VgqCq4Rw@mail.gmail.com>
In-reply-to <1583422946.86.0.274704131552.issue39864@roundup.psfhosted.org>
Content
I believe it's a bug. The axis 0 is misleading.  However, it is a problem
for numpy developers. Thank you for your time.

On Thu, Mar 5, 2020, 10:42 AM Peter Otten <report@bugs.python.org> wrote:

>
> Peter Otten <__peter__@web.de> added the comment:
>
> This is not a bug (and if it were you would have to report to numpy, not
> cpython).
>
> Consider:
>
> >>> import numpy
> >>> a = numpy.zeros((2,2,2))
> >>> a[0,2]
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> IndexError: index 2 is out of bounds for axis 1 with size 2
>
> This is probably the message you expect. However, if you write
> >>> a[0][2]
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> IndexError: index 2 is out of bounds for axis 0 with size 2
>
> you split the operation into two steps, and the second axis of a is
> effectively the first axis of a[0].
>
> ----------
> nosy: +peter.otten -steven.daprano
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue39864>
> _______________________________________
>
History
Date User Action Args
2020-03-06 02:25:56ningyidusetrecipients: + ningyidu, peter.otten
2020-03-06 02:25:56ningyidulinkissue39864 messages
2020-03-06 02:25:56ningyiducreate