Issue 2690: Add support for slicing and negative indices to range objects (includes precalculation and storage of the range length).
Refer to the tracker issue for the language moratorium implications of this change
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index d6df5ba..bb392fc 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1023,8 +1023,33 @@
>>> list(range(1, 0))
[]
+ Range objects implement the :class:`collections.Sequence` ABC, and provide
+ features such as containment tests, element index lookup, slicing and
+ support for negative indices:
+
+ >>> r = range(0, 20, 2)
+ >>> r
+ range(0, 20, 2)
+ >>> 11 in r
+ False
+ >>> 10 in r
+ True
+ >>> r.index(10)
+ 5
+ >>> r[5]
+ 10
+ >>> r[:5]
+ range(0, 10, 2)
+ >>> r[-1]
+ 18
+
+ Ranges containing absolute values larger than ``sys.maxint`` are permitted
+ but some features (such as :func:`len`) will raise :exc:`OverflowError`.
+
.. versionchanged:: 3.2
- Testing integers for membership takes constant time instead of iterating
+ Implement the Sequence ABC
+ Support slicing and negative indices
+ Test integers for membership in constant time instead of iterating
through all items.