[New-bugs-announce] [issue22785] range docstring is less useful than in python 2
Ned Batchelder
report at bugs.python.org
Sun Nov 2 22:07:03 CET 2014
New submission from Ned Batchelder:
The Python 3.4 docstring for range is:
{{{
| range(stop) -> range object
| range(start, stop[, step]) -> range object
|
| Return a virtual sequence of numbers from start to stop by step.
}}}
In Python 2.7, it said:
{{{
range(stop) -> list of integers
range(start, stop[, step]) -> list of integers
Return a list containing an arithmetic progression of integers.
range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.
When step is given, it specifies the increment (or decrement).
For example, range(4) returns [0, 1, 2, 3]. The end point is omitted!
These are exactly the valid indices for a list of 4 elements.
}}}
Note that Python 3 seems to imply that the end-point is included, while Python 2 made clear that it was not. "Arithmetic progression" is a bit involved, but it would be good to mention that the end-point is omitted in the Python 3 docstring.
----------
assignee: docs at python
components: Documentation
messages: 230525
nosy: docs at python, nedbat
priority: normal
severity: normal
status: open
title: range docstring is less useful than in python 2
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22785>
_______________________________________
More information about the New-bugs-announce
mailing list