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


Groups > comp.lang.python > #8424

Re: Interpreting Left to right?

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Interpreting Left to right?
Date 2011-06-24 20:56 -0400
References (3 earlier) <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>
Newsgroups comp.lang.python
Message-ID <mailman.398.1308963438.1164.python-list@python.org> (permalink)

Show all headers | 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