Message230525
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. |
|
Date |
User |
Action |
Args |
2014-11-02 21:07:03 | nedbat | set | recipients:
+ nedbat, docs@python |
2014-11-02 21:07:03 | nedbat | set | messageid: <1414962423.59.0.0293441090984.issue22785@psf.upfronthosting.co.za> |
2014-11-02 21:07:03 | nedbat | link | issue22785 messages |
2014-11-02 21:07:03 | nedbat | create | |
|