[Python-checkins] r87129 - python/branches/py3k/Doc/whatsnew/3.2.rst
raymond.hettinger
python-checkins at python.org
Wed Dec 8 11:18:21 CET 2010
Author: raymond.hettinger
Date: Wed Dec 8 11:18:21 2010
New Revision: 87129
Log:
range() example
Modified:
python/branches/py3k/Doc/whatsnew/3.2.rst
Modified: python/branches/py3k/Doc/whatsnew/3.2.rst
==============================================================================
--- python/branches/py3k/Doc/whatsnew/3.2.rst (original)
+++ python/branches/py3k/Doc/whatsnew/3.2.rst Wed Dec 8 11:18:21 2010
@@ -508,7 +508,16 @@
:class:`collections.Sequence` :term:`abstract base class`. As a result, the
language will have a more uniform API. In addition, :class:`range` objects
now support slicing and negative indices. This makes *range* more
- interoperable with lists.
+ interoperable with lists::
+
+ >>> range(0, 100, 2).count(10)
+ 1
+ >>> range(0, 100, 2).index(10)
+ 5
+ >>> range(0, 100, 2)[5]
+ 10
+ >>> range(0, 100, 2)[0:5]
+ range(0, 10, 2)
(Contributed by Daniel Stuzback in :issue:`9213` and by Alexander Belopolsky
in :issue:`2690`.)
More information about the Python-checkins
mailing list