diff options
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/functions.rst | 17 | ||||
-rw-r--r-- | Doc/library/pprint.rst | 5 |
2 files changed, 11 insertions, 11 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) |