diff --git a/advanced-iterators.html b/advanced-iterators.html index 9574652..b54dedd 100755 --- a/advanced-iterators.html +++ b/advanced-iterators.html @@ -390,7 +390,7 @@ Wesley [(0, 10), (1, 11), (2, 12), (None, 13)]
itertools.chain() function takes two iterators and returns an iterator that contains all the items from the first iterator, followed by all the items from the second iterator. (Actually, it can take any number of iterators, and it chains them all in the order they were passed to the function.)
-zip() function does something prosaic that turns out to be extremely useful: it takes any number of sequences and returns an iterator with the first items of each sequence, then the second items of each, then the third, and so on.
+zip() function does something prosaic that turns out to be extremely useful: it takes any number of sequences and returns an iterator which returns tuples of the first items of each sequence, then the second items of each, then the third, and so on.
zip() function stops at the end of the shortest sequence. range(10, 14) has 4 items (10, 11, 12, and 13), but range(0, 3) only has 3, so the zip() function returns an iterator of 3 items.
itertools.zip_longest() function stops at the end of the longest sequence, inserting None values for items past the end of the shorter sequences.