diff options
author | Benjamin Peterson <benjamin@python.org> | 2011-11-05 19:17:52 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2011-11-05 19:17:52 (GMT) |
commit | 878ce389a08594a805cf382a73414be02143396c (patch) | |
tree | c1c9a9b02e23dd3461d2c3bc894a2d99dc5c8771 /Doc/library/functions.rst | |
parent | 03b081938954a333fb5473977ee8d22e9699bc5b (diff) | |
download | cpython-878ce389a08594a805cf382a73414be02143396c.zip cpython-878ce389a08594a805cf382a73414be02143396c.tar.gz cpython-878ce389a08594a805cf382a73414be02143396c.tar.bz2 |
add introspection to range objects (closes #9896)
Patch by Daniel Urban.
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r-- | Doc/library/functions.rst | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index f9af3d8..3cf5335 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1042,7 +1042,9 @@ are always available. They are listed here in alphabetical order. ...]``. 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 smallest ``start + i * step`` greater than *stop*. *step* must not be zero - (or else :exc:`ValueError` is raised). Example: + (or else :exc:`ValueError` is raised). Range objects have read-only data + attributes :attr:`start`, :attr:`stop` and :attr:`step` which return the + argument values (or their default). Example: >>> list(range(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] @@ -1100,6 +1102,9 @@ are always available. They are listed here in alphabetical order. sequence of values they define (instead of comparing based on object identity). + .. versionadded:: 3.3 + The :attr:`start`, :attr:`stop` and :attr:`step` attributes. + .. function:: repr(object) |