@@ -1727,12 +1727,12 @@ are always available. They are listed here in alphabetical order.
17271727
17281728 Example::
17291729
1730- >>> for item in zip(['a', 'b', 'c' ], [1, 2, 3 ]):
1730+ >>> for item in zip([1, 2, 3 ], ['sugar', 'spice', 'everything nice' ]):
17311731 ... print(item)
17321732 ...
1733- ('a', 1 )
1734- ('b', 2 )
1735- ('c', 3 )
1733+ (1, 'sugar' )
1734+ (2, 'spice' )
1735+ (3, 'everything nice' )
17361736
17371737 More formally: :func: `zip ` returns an iterator of tuples, where the *i *-th
17381738 tuple contains the *i *-th element from each of the argument iterables.
@@ -1741,17 +1741,18 @@ are always available. They are listed here in alphabetical order.
17411741 columns into rows. This is similar to `transposing a matrix
17421742 <https://en.wikipedia.org/wiki/Transpose> `_.
17431743
1744- :func: `zip ` is lazy: The elements wouldn't be processed until the iterable
1745- is iterated on, e.g. by wrapping in a :class: `list `.
1744+ :func: `zip ` is lazy: The elements won't be processed until the iterable is
1745+ iterated on, e.g. by a :keyword: `!for ` loop or by wrapping in a
1746+ :class: `list `.
17461747
17471748 One thing to consider is that the iterables passed to :func: `zip ` could have
17481749 different lengths; sometimes by design, and sometimes because of a bug in
17491750 the code that prepared these iterables. Python offers three different
17501751 approaches to dealing with this issue:
17511752
17521753 * By default, :func: `zip ` stops when the shortest iterable is exhausted.
1753- :func: ` zip ` will ignore the remaining items in the longer iterables, cutting
1754- off the result to the length of the shortest iterable::
1754+ It will ignore the remaining items in the longer iterables, cutting off
1755+ the result to the length of the shortest iterable::
17551756
17561757 >>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))
17571758 [(0, 'fee'), (1, 'fi'), (2, 'fo')]
@@ -1776,7 +1777,7 @@ are always available. They are listed here in alphabetical order.
17761777 * Shorter iterables can be padded with a constant value to make all the
17771778 iterables equal. This is done by :func: `itertools.zip_longest `.
17781779
1779- Special cases: With a single iterable argument, :func: `zip ` returns an
1780+ Edge cases: With a single iterable argument, :func: `zip ` returns an
17801781 iterator of 1-tuples. With no arguments, it returns an empty iterator.
17811782
17821783 Tips and tricks:
0 commit comments