为什么为 numpy 函数选择名称 "arange"?

Why was the name "arange" chosen for the numpy function?

numpy 函数 arange 被如此命名是否有特定原因?

人们 habitually 打错了 arrange,假设它被拼写为英文单词,所以考虑到其他拼写不那么模糊的选项(range 等)未被 numpy 使用。

它是否被选为 array 和 range 的合成词?

明确地modelled on Python range 函数。前缀 a 的先例是在 Python 1 中已经有 range 的变体,称为 xrange.

NumPy 派生自一个名为 Numeric 的旧 python 库(实际上是 the first array object built for python)。 arange 函数可以追溯到这个库,其词源在其手册中有详细说明:

arrayrange()

The arrayrange() function is similar to the range() function in Python, except that it returns an array as opposed to a list.

...

arange() is a shorthand for arrayrange().

  • Numeric Manual
    2001 (p. 18-19), 1999 (p.23)

很明显,还有另一个带有 array(range(25)) 的示例(第 16 页),它在功能上与 arrayrange().

相同