Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 581f33a

Browse files
committed
Added zip() builtin
1 parent 3027b15 commit 581f33a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Doc/whatsnew/whatsnew20.tex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,14 @@ \section{Core Changes}
477477
its argument. For example, \code{'\%r \%s' \% ('abc', 'abc')} returns a
478478
string containing \verb|'abc' abc|.
479479
480+
A new built-in, \function{zip(\var{seq1}, \var{seq2}, ...)}, has been
481+
added. \function{zip()} returns a list of tuples where each tuple
482+
contains the i-th element from each of the argument sequences. The
483+
difference between \function{zip()} and \code{map(None, \var{seq1},
484+
\var{seq2})} is that \function{map()} raises an error if the sequences
485+
aren't all of the same length, while \function{zip()} truncates the
486+
returned list to the length of the shortest argument sequence.
487+
480488
The \function{int()} and \function{long()} functions now accept an
481489
optional ``base'' parameter when the first argument is a string.
482490
\code{int('123', 10)} returns 123, while \code{int('123', 16)} returns

0 commit comments

Comments
 (0)