Issue528748
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2002-03-12 00:49 by cjwhrh, last changed 2022-04-10 16:05 by admin. This issue is now closed.
Messages (3) | |||
---|---|---|---|
msg9644 - (view) | Author: Colin J. Williams (cjwhrh) | Date: 2002-03-12 00:49 | |
The help now has: range([start,] stop[, step]) This is a versatile function to create lists containing arithmetic progressions. It is most often used in for loops. The arguments must be plain integers. If the step argument is omitted, it defaults to 1. If the start argument is omitted, it defaults to 0. The full form returns a list of plain integers [start, start + step, start + 2 * step, ...]. If step is positive, the last element is the largest start + i * step less than stop; if step is negative, the last element is the largest start + i * step greater than stop. step must not be zero (or else ValueError is raised). It might say: range([start= 0,] stop[, step= 1]) This function creates a list containing an arithmetic progression. The arguments must be integers. If only one argument is passed it is the 'stop' value, if two values are passed then the first is the 'start' value and the second the 'stop' value. The function returns a list of integers [start, start + step, start + 2 * step, ...]. The 'step' must not be zero; if 'step' is positive, the last element is the largest; if 'step' is negative, the last element is the smallest. ----------------------------------------------------------- Using Python 2.2 The main intent is to clarify the usage of the optional arguments. |
|||
msg9645 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2002-04-12 20:52 | |
Logged In: YES user_id=80475 IMO, the current version is clearer than the re-write. Also, the docs add further clarity by showing 7 examples. The proposed documentation style, range([start=0,] stop [,step=1 ]) is inconsistent with the style used in the rest of the docs. A side note, the docstring for range() is shorter and clearer than both of the above: range(...) 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. |
|||
msg9646 - (view) | Author: Fred Drake (fdrake) | Date: 2002-06-17 15:30 | |
Logged In: YES user_id=3066 I agree with Raymond. Closing the bug as rejected. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:05:05 | admin | set | github: 36242 |
2002-03-12 00:49:53 | cjwhrh | create |