]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
improved range docstring (closes #22785)
authorBenjamin Peterson <benjamin@python.org>
Wed, 22 Apr 2015 13:16:07 +0000 (09:16 -0400)
committerBenjamin Peterson <benjamin@python.org>
Wed, 22 Apr 2015 13:16:07 +0000 (09:16 -0400)
Patch by Ned Batchelder.

Objects/rangeobject.c

index 7e6c733f3e28e1cf2b3de3d420d0140296475ca4..ca66a45d5fe4c34e5a08971712f0f769f68b9834 100644 (file)
@@ -139,7 +139,11 @@ PyDoc_STRVAR(range_doc,
 "range(stop) -> range object\n\
 range(start, stop[, step]) -> range object\n\
 \n\
-Return a sequence of numbers from start to stop by step.");
+Return an object that produces a sequence of integers from start (inclusive)\n\
+to stop (exclusive) by step.  range(i, j) produces i, i+1, i+2, ..., j-1.\n\
+start defaults to 0, and stop is omitted!  range(4) produces 0, 1, 2, 3.\n\
+These are exactly the valid indices for a list of 4 elements.\n\
+When step is given, it specifies the increment (or decrement).");
 
 static void
 range_dealloc(rangeobject *r)