numpy 索引文档中的错误示例?

Wrong examples in numpy indexing documentation?

在numpy索引page上,有一段警告

The definition of advanced indexing means that x[(1,2,3),] is fundamentally different than x[(1,2,3)]. The latter is equivalent to x[1,2,3] which will trigger basic selection while the former will trigger advanced indexing. Be sure to understand why this occurs.

我试过运行下面的代码

import numpy as np

x = np.arange(3*4).reshape((3, 4))
y = x[(1, 2)]
z = x[(1, 2),]

print("base:", x.base, y.base, z.base)
print("id:", id(x.base), id(y.base), id(z.base))
print(np.shares_memory(x, y), np.shares_memory(x, z))

得到的结果是

base: [ 0  1  2  3  4  5  6  7  8  9 10 11] None None
id: 4299634928 4297628200 4297628200
False False

似乎 y 没有 return 和 view 因此 x[(1, 2)] 不能成为基本索引,因为

All arrays generated by basic slicing are always views of the original array.

是不是文档有误?还是我哪里理解错了?

y 不是视图,因为它是标量,而不是数组。基本切片生成的所有数组始终是原始数组的视图。