Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19088
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!feed.xsnews.nl!border-3.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <chris@rebertia.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.044 |
| X-Spam-Evidence | '*H*': 0.91; '*S*': 0.00; '===': 0.09; 'am,': 0.12; 'cc:addr:python-list': 0.15; '(2,': 0.16; '3),': 0.16; 'subject:function': 0.16; 'x2,': 0.16; 'wrote:': 0.16; 'wed,': 0.17; '>>>': 0.18; 'jan': 0.19; 'cheers,': 0.20; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'received:209.85.220': 0.27; 'cc:addr:gmail.com': 0.28; 'message- id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'chris': 0.30; 'subject:?': 0.30; 'url:library': 0.30; 'url:python': 0.36; 'cc:2**1': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.38; 'url:docs': 0.39; 'url:org': 0.39; 'received:209': 0.39; 'subject:: ': 0.39; 'taylor': 0.67; 'brown': 0.80; '(4,': 0.84; 'sender:addr:chris': 0.84; 'url:functions': 0.84; 'url:rebertia': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=7GvvrJe9hC9/rdqkGEfYfXmB5huYHqUgUEzXdkjWmhU=; b=FtFbC77tKKUpGBYVOEpLYtoz9vhaX10o086nT62Z/BTvfYbr7OICzTeKmdd2alj1J5 HfEWzaQUm4AKEg3IJny70pmAtutKs5tHfsY90YAEy9wrRFixEWhM0bmFmta4DgvmHuPm Xtma975FRIpywPJPkJl60VnMXLf0mYaKZ/8XY= |
| MIME-Version | 1.0 |
| Sender | chris@rebertia.com |
| In-Reply-To | <CABRP1o-pfRfZm6Mde_LNukYvkm+dvjhysemD=Q_VoTaa4WXQ6g@mail.gmail.com> |
| References | <jf6l7v$m3k$1@dough.gmane.org> <CAO+9iGfC60mJFgFwJNBEDE+bx4zkNUEunMAg3urCN-3RJd0g7Q@mail.gmail.com> <CAO+9iGcG_=xhVP1W=TRJo6fSCTNPQJ4cvsiYHRi5c7_fmJs-vQ@mail.gmail.com> <CABRP1o-pfRfZm6Mde_LNukYvkm+dvjhysemD=Q_VoTaa4WXQ6g@mail.gmail.com> |
| Date | Wed, 18 Jan 2012 07:38:57 -0800 |
| X-Google-Sender-Auth | mCuFjOUMeh7I5neYbdSmuKQRE60 |
| Subject | Re: unzip function? |
| From | Chris Rebert <clp2@rebertia.com> |
| To | Rodrick Brown <rodrick.brown@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | Neal Becker <ndbecker2@gmail.com>, python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4834.1326901142.27778.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1326901142 news.xs4all.nl 6908 [2001:888:2000:d::a6]:41106 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19088 |
Show key headers only | View raw
On Wed, Jan 18, 2012 at 7:31 AM, Rodrick Brown <rodrick.brown@gmail.com> wrote: > On Wed, Jan 18, 2012 at 10:27 AM, Alec Taylor <alec.taylor6@gmail.com> > wrote: >> >> http://docs.python.org/library/functions.html >> >>> x = [1, 2, 3] >> >>> y = [4, 5, 6] >> >>> zipped = zip(x, y) >> >>> zipped >> [(1, 4), (2, 5), (3, 6)] >> >>> x2, y2 = zip(*zipped) >> >>> x == list(x2) and y == list(y2) >> True > > > Alec can you explain this behavior zip(*zipped)? It's just the application of the http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists feature to a zip() [http://docs.python.org/library/functions.html#zip ] call. zip(*zipped) === zip(*[(1, 4), (2, 5), (3, 6)]) === zip((1, 4), (2, 5), (3, 6)) === [(1, 2, 3), (4, 5, 6)] Cheers, Chris -- http://rebertia.com
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: unzip function? Chris Rebert <clp2@rebertia.com> - 2012-01-18 07:38 -0800
csiph-web