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

2 min read Original article ↗

2 Answers 2

NumPy derives from an older python library called Numeric (in fact, the first array object built for python). The arange function dates back to this library, and its etymology is detailed in its manual:

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)

Tellingly, there is another example with array(range(25)) (p.16), which is functionally the same as arrayrange().

Dharman's user avatar

Dharman

34k27 gold badges106 silver badges158 bronze badges

answered Mar 11, 2019 at 17:40

End genocide - save Gaza's user avatar

Sign up to request clarification or add additional context in comments.

1 Comment

And linspace is for linearly space(vs geomspace and logspace)?

It is explicitly modelled on the Python range function. The precedent for prefixing a was that in Python 1 there was already a variant of range called xrange.

answered Mar 11, 2019 at 13:30

BoarGules's user avatar

4 Comments

Though I wouldn't surprised if arange preceeds xrange. Any idea when xrange was added to Py2?

@hpaulj, Looking at python.org/doc/versions, it seems to have been added in python2.0, in October 2000.

xrange was in Python 1.5.2 (1998). Maybe earlier, but that would have been before my time.

Start asking to get answers

Find the answer to your question by asking.

Ask question