diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-10-11 00:49:57 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-10-11 00:49:57 (GMT) |
commit | f10a79aad4e2fc62d2c3675e89f873b22b185e7b (patch) | |
tree | 06b042ca03a71663d26ad95949807d1bd2472bf4 /Doc/library/functions.rst | |
parent | 2d8dcdcb06005858e87eded012ceff10920445b7 (diff) | |
download | cpython-f10a79aad4e2fc62d2c3675e89f873b22b185e7b.zip cpython-f10a79aad4e2fc62d2c3675e89f873b22b185e7b.tar.gz cpython-f10a79aad4e2fc62d2c3675e89f873b22b185e7b.tar.bz2 |
merge from trunk
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r-- | Doc/library/functions.rst | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index ac25510..818ce45 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -22,9 +22,8 @@ are always available. They are listed here in alphabetical order. The function is invoked by the :keyword:`import` statement. It mainly exists so that you can replace it with another function that has a compatible interface, in order to change the semantics of the :keyword:`import` - statement. See also the built-in module :mod:`imp`, which - defines some useful operations out of which you can build your own - :func:`__import__` function. + statement. See the built-in module :mod:`imp`, which defines some useful + operations out of which you can build your own :func:`__import__` function. For example, the statement ``import spam`` results in the following call: ``__import__('spam', globals(), locals(), [], -1)``; the statement @@ -1201,6 +1200,18 @@ are always available. They are listed here in alphabetical order. care about trailing, unmatched values from the longer iterables. If those values are important, use :func:`itertools.zip_longest` instead. + :func:`zip` in conjunction with the ``*`` operator can be used to unzip a + list:: + + >>> x = [1, 2, 3] + >>> y = [4, 5, 6] + >>> zipped = zip(x, y) + >>> zipped + [(1, 4), (2, 5), (3, 6)] + >>> x2, y2 = zip(*zipped) + >>> x == x2, y == y2 + True + .. rubric:: Footnotes |