Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95649

Re: [a,b,c,d] = 1,2,3,4

Path csiph.com!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!feeder.erje.net!1.eu.feeder.erje.net!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.018
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:: [': 0.03; 'sequences.': 0.07; 'cc:addr:python-list': 0.09; 'wed,': 0.15; '*any*': 0.16; '12:59': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sequence,': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'message- id:@mail.gmail.com': 0.27; 'add': 0.34; 'lists': 0.34; 'received:google.com': 0.35; 'instance': 0.35; 'side': 0.62; 'more': 0.63; '26,': 0.72; 'subject:,': 0.82; 'answer,': 0.84; 'chrisa': 0.84; 'to:none': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=XK0XrslJatUJXeR4iQUN7vuOmuuVwKXZQdaCIAUwjqQ=; b=Kb3bKstiu3TbPde4nKJxmhBbe3iz19i8j3jm+j7M37ox5/VltN9C2Iqsj0XMSLR+E9 cZQJT3a09ELHvr8AlGAodfiWoftZCxPDS9AVhF/1NKhABPIplQ0yEZKbsGGs0lZPkPIV syorVavUQn0zcnUMypyOvT7fnwiWXF3EXlhNAdQbKYhaJoA3u8Y62gn3Wd3+1ocMbJ86 SqaqQqjvYWEPQJolj3MHhc/v/ZMHtIwftVIBs1qi6PZs/AJhZD79pMyzVlGWcPSc2/jd RCO8F3fv/uKeCnWBqIyPOUsiblhGm/D71XxidaTTScnL4Z4q9q82HhKmRfsnTIY0d/O8 tgbA==
MIME-Version 1.0
X-Received by 10.107.12.166 with SMTP id 38mr3197038iom.157.1440594245407; Wed, 26 Aug 2015 06:04:05 -0700 (PDT)
In-Reply-To <935842626.955183.1440514765199.JavaMail.root@sequans.com>
References <CAPM-O+y-FftPRv7_VqSG6JVp3ocr__yd=RuppLh5ZWcMg25v+g@mail.gmail.com> <935842626.955183.1440514765199.JavaMail.root@sequans.com>
Date Wed, 26 Aug 2015 23:04:05 +1000
Subject Re: [a,b,c,d] = 1,2,3,4
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.43.1440594254.11709.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1440594254 news.xs4all.nl 23848 [2001:888:2000:d::a6]:54094
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 3256
X-Received-Body-CRC 553456953
Xref csiph.com comp.lang.python:95649

Show key headers only | View raw


On Wed, Aug 26, 2015 at 12:59 AM, Jean-Michel Pichavant
<jeanmichel@sequans.com> wrote:
> To add to Joel's answer, the right side can be *any* sequence, and is not restricted to lists or tuples.
>
> a, b, c = (x for x in range(3)) # a generator for instance

FWIW, a generator is not a sequence; this works because the right side
can be any *iterable*, even more general than sequences.

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [a,b,c,d] = 1,2,3,4 Chris Angelico <rosuav@gmail.com> - 2015-08-26 23:04 +1000

csiph-web