diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/functions.rst | 17 | ||||
-rw-r--r-- | Doc/library/pprint.rst | 5 | ||||
-rw-r--r-- | Doc/reference/executionmodel.rst | 8 | ||||
-rw-r--r-- | Doc/whatsnew/2.6.rst | 6 |
4 files changed, 18 insertions, 18 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 9ccc59c..582abbf 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -325,14 +325,15 @@ are always available. They are listed here in alphabetical order. < abs(b)``. -.. function:: enumerate(iterable) - - Return an enumerate object. *iterable* must be a sequence, an :term:`iterator`, or some - other object which supports iteration. The :meth:`__next__` method of the - iterator returned by :func:`enumerate` returns a tuple containing a count (from - zero) and the corresponding value obtained from iterating over *iterable*. - :func:`enumerate` is useful for obtaining an indexed series: ``(0, seq[0])``, - ``(1, seq[1])``, ``(2, seq[2])``, .... For example: +.. function:: enumerate(sequence) + + Return an enumerate object. *sequence* must be a sequence, an + :term:`iterator`, or some other object which supports iteration. The + :meth:`__next__` method of the iterator returned by :func:`enumerate` returns a + tuple containing a count (from zero) and the corresponding value obtained + from iterating over *iterable*. :func:`enumerate` is useful for obtaining an + indexed series: ``(0, seq[0])``, ``(1, seq[1])``, ``(2, seq[2])``, .... For + example: >>> for i, season in enumerate(['Spring', 'Summer', 'Fall', 'Winter')]: ... print(i, season) diff --git a/Doc/library/pprint.rst b/Doc/library/pprint.rst index 8c28879..940e4c4 100644 --- a/Doc/library/pprint.rst +++ b/Doc/library/pprint.rst @@ -60,8 +60,7 @@ The :mod:`pprint` module defines one class: ... ('parrot', ('fresh fruit',)))))))) >>> pp = pprint.PrettyPrinter(depth=6) >>> pp.pprint(tup) - ('spam', - ('eggs', ('lumberjack', ('knights', ('ni', ('dead', ('parrot', (...,)))))))) + ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead', (...))))))) The :class:`PrettyPrinter` class supports several derivative functions: @@ -208,7 +207,7 @@ This example demonstrates several uses of the :func:`pprint` function and its pa ['cccccccccccccccccccc', 'dddddddddddddddddddd']] >>> pprint.pprint(stuff, depth=3) ['aaaaaaaaaa', - ('spam', ('eggs', ('lumberjack', (...)))), + ('spam', ('eggs', (...))), ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'], ['cccccccccccccccccccc', 'dddddddddddddddddddd']] >>> pprint.pprint(stuff, width=60) diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst index 43515d9..fefc146 100644 --- a/Doc/reference/executionmodel.rst +++ b/Doc/reference/executionmodel.rst @@ -198,10 +198,10 @@ the code block where the error occurred. The Python interpreter raises an exception when it detects a run-time error (such as division by zero). A Python program can also explicitly raise an exception with the :keyword:`raise` statement. Exception handlers are specified -with the :keyword:`try` ... :keyword:`except` statement. The :keyword:`try` ... -:keyword:`finally` statement specifies cleanup code which does not handle the -exception, but is executed whether an exception occurred or not in the preceding -code. +with the :keyword:`try` ... :keyword:`except` statement. The :keyword:`finally` +clause of such a statement can be used to specify cleanup code which does not +handle the exception, but is executed whether an exception occurred or not in +the preceding code. .. index:: single: termination model diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index 9708c67..c39c80a 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -627,9 +627,9 @@ docs), but here's a sample:: 'g' - General format. This prints the number as a fixed-point number, unless the number is too large, in which case it switches to 'e' exponent notation. - 'n' - Number. This is the same as 'g', except that it uses the - current locale setting to insert the appropriate - number separator characters. + 'n' - Number. This is the same as 'g' (for floats) or 'd' (for + integers), except that it uses the current locale setting to + insert the appropriate number separator characters. '%' - Percentage. Multiplies the number by 100 and displays in fixed ('f') format, followed by a percent sign. |