mirror of
https://github.com/python/cpython.git
synced 2025-08-15 14:20:55 +00:00
Merged revisions 67326,67498,67531-67532,67538,67553-67554,67556-67557 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r67326 | benjamin.peterson | 2008-11-22 02:59:15 +0100 (Sat, 22 Nov 2008) | 1 line backport r67325: make FileIO.mode always contain 'b' ........ r67498 | raymond.hettinger | 2008-12-03 16:42:10 +0100 (Wed, 03 Dec 2008) | 1 line Backport r67478 ........ r67531 | georg.brandl | 2008-12-04 19:54:05 +0100 (Thu, 04 Dec 2008) | 2 lines Add reference to enumerate() to indices example. ........ r67532 | georg.brandl | 2008-12-04 19:59:16 +0100 (Thu, 04 Dec 2008) | 2 lines Add another heapq example. ........ r67538 | georg.brandl | 2008-12-04 22:28:16 +0100 (Thu, 04 Dec 2008) | 2 lines Clarification to avoid confusing output with file descriptors. ........ r67553 | georg.brandl | 2008-12-05 08:49:49 +0100 (Fri, 05 Dec 2008) | 2 lines #4408: document regex.groups. ........ r67554 | georg.brandl | 2008-12-05 08:52:26 +0100 (Fri, 05 Dec 2008) | 2 lines #4409: fix asterisks looking like footnotes. ........ r67556 | georg.brandl | 2008-12-05 09:02:17 +0100 (Fri, 05 Dec 2008) | 2 lines #4441: improve doc for os.open() flags. ........ r67557 | georg.brandl | 2008-12-05 09:06:57 +0100 (Fri, 05 Dec 2008) | 2 lines Add an index entry for "subclassing immutable types". ........
This commit is contained in:
parent
5667280a07
commit
fa71a90703
12 changed files with 74 additions and 42 deletions
|
@ -104,8 +104,8 @@ increment (even negative; sometimes this is called the 'step')::
|
|||
>>> range(-10, -100, -30)
|
||||
[-10, -40, -70]
|
||||
|
||||
To iterate over the indices of a sequence, combine :func:`range` and :func:`len`
|
||||
as follows::
|
||||
To iterate over the indices of a sequence, you can combine :func:`range` and
|
||||
:func:`len` as follows::
|
||||
|
||||
>>> a = ['Mary', 'had', 'a', 'little', 'lamb']
|
||||
>>> for i in range(len(a)):
|
||||
|
@ -117,6 +117,9 @@ as follows::
|
|||
3 little
|
||||
4 lamb
|
||||
|
||||
In most such cases, however, it is convenient to use the :func:`enumerate`
|
||||
function, see :ref:`tut-loopidioms`.
|
||||
|
||||
|
||||
.. _tut-break:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue