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


Groups > comp.lang.python > #8424

Re: Interpreting Left to right?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'terry': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'wrote:': 0.15; '(remember': 0.16; 'a,b,c': 0.16; 'assigns': 0.16; 'evaluates': 0.16; 'reedy': 0.16; 'tuple)': 0.16; 'pm,': 0.16; 'previously': 0.19; 'jan': 0.19; 'modify': 0.22; 'header:In-Reply- To:1': 0.22; 'statement': 0.25; 'bound': 0.29; 'object': 0.30; 'subject:?': 0.31; 'expression': 0.32; 'list': 0.33; 'header:User- Agent:1': 0.34; 'header:X-Complaints-To:1': 0.34; 'to:addr:python- list': 0.34; 'fail': 0.34; 'assignment': 0.35; 'latter': 0.35; 'lists,': 0.35; 'but': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'list,': 0.39; 'to:addr:python.org': 0.39; 'target': 0.61; 'order': 0.62; 'here': 0.66; '"an': 0.84; '[1,2]': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Interpreting Left to right?
Date Fri, 24 Jun 2011 20:56:58 -0400
References <BANLkTimcPAjQP4JJk=OAbrkLFfd2AtndwQ@mail.gmail.com> <iu1aaq$rni$1@dough.gmane.org> <4E043953.5080705@stoneleaf.us> <20110624195300.GJ6075@point.cs.wisc.edu> <4E04EFD4.6050309@stoneleaf.us> <20110624200618.GK6075@point.cs.wisc.edu> <nad-C01F34.13242424062011@news.gmane.org> <20110624210835.GL6075@point.cs.wisc.edu>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host rain.gmane.org
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11
In-Reply-To <20110624210835.GL6075@point.cs.wisc.edu>
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.398.1308963438.1164.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 82.94.164.166
X-Trace 1308963438 news.xs4all.nl 182 [::ffff:82.94.164.166]:34197
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8424

Show key headers only | View raw


On 6/24/2011 5:08 PM, Tycho Andersen wrote:

> "An assignment statement evaluates the expression list (remember that
> this can be a single expression or a comma-separated list, the latter
> yielding a tuple) and assigns the single resulting object to each of
> the target lists, from left to right."

This is the 'other' type of 'multiple assignment'

a,b,c = 1,2,3

Order matters here too.

a,a[1] = [1,2],3
a
# [1,3]
# but

a[1], a = 3, [1,2]
will either fail or modify what a was previously bound to before 
rebinding a to [1,2].

-- 
Terry Jan Reedy

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


Thread

Re: Interpreting Left to right? Terry Reedy <tjreedy@udel.edu> - 2011-06-24 20:56 -0400

csiph-web