diff options
| -rw-r--r-- | numpy/core/_add_newdocs.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py index e432f6a11..e5262b643 100644 --- a/numpy/core/_add_newdocs.py +++ b/numpy/core/_add_newdocs.py @@ -1598,15 +1598,24 @@ add_newdoc('numpy.core.multiarray', 'arange', Return evenly spaced values within a given interval. - Values are generated within the half-open interval ``[start, stop)`` - (in other words, the interval including `start` but excluding `stop`). + ``arange`` can be called with a varying number of positional arguments: + + * ``arange(stop)``: Values are generated within the half-open interval + ``[0, stop)`` (in other words, the interval including `start` but + excluding `stop`). + * ``arange(start, stop)``: Values are generated within the half-open + interval ``[start, stop)``. + * ``arange(start, stop, step)`` Values are generated within the half-open + interval ``[start, stop)``, with spacing between values given by + ``step``. + For integer arguments the function is roughly equivalent to the Python built-in :py:class:`range`, but returns an ndarray rather than a ``range`` instance. When using a non-integer step, such as 0.1, it is often better to use `numpy.linspace`. - + See the Warning sections below for more information. Parameters @@ -1623,10 +1632,10 @@ add_newdoc('numpy.core.multiarray', 'arange', between two adjacent values, ``out[i+1] - out[i]``. The default step size is 1. If `step` is specified as a position argument, `start` must also be given. - dtype : dtype + dtype : dtype, optional The type of the output array. If `dtype` is not given, infer the data type from the other input arguments. - ${ARRAY_FUNCTION_LIKE} + ${ARRAY_FUNCTION_LIKE} This is an optional argument. .. versionadded:: 1.20.0 |
