Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Sven R. Kunze" Newsgroups: comp.lang.python Subject: Re: Multiple Assignment a = b = c Date: Tue, 16 Feb 2016 14:10:26 +0100 Lines: 21 Message-ID: References: <56C31E9E.1060609@mail.de> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de piMoyK4fzZgt7B/uvI7tIA7Ponst/v+xtTKRmxbCxwAA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'assignment': 0.07; 'statements': 0.09; 'tuple': 0.09; '14:05,': 0.16; 'evaluated.': 0.16; 'lhs': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'rhs': 0.16; 'wrote:': 0.16; 'basically': 0.18; 'first,': 0.20; 'suggested': 0.20; 'header:In-Reply-To:1': 0.24; 'right.': 0.27; 'skip:( 20': 0.28; 'second,': 0.29; 'received:10.0': 0.34; 'best,': 0.35; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'two': 0.37; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'charset:windows-1252': 0.62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mail201212; t=1455628227; bh=Xu1qMghsHrfdzxSbjU8vlKQjGMluX63YsKhuLHM/5jE=; h=Subject:To:References:From:Date:In-Reply-To:From; b=w9ts3FOz4cTp5WyyZbj7cBZvsylWNn4QHznHwUGTjHwPPvgxILcix1ZNRZ6VRBUXT al6Mcl654U5IO7Fj0wLSk9MDMde2cdl7YOxc0aCegpbbU30Wwut8wgd0kROPBMk+xg ykWwVE0b4Hh7i1WmgEULg4L+BVPSxo6ZadIOKlcM= In-Reply-To: <56C31E9E.1060609@mail.de> X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 421 X-purgate-ID: 154282::1455628227-00004575-A06AC3BB/0/0 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103003 On 16.02.2016 14:05, Sven R. Kunze wrote: > Hi Srinivas, > > I think the tuple assignment you showed basically nails it. > > First, the rhs is evaluated. > Second, the lhs is evaluated from left to right. > > Completely wrong? > > Best, > Sven As you mentioned swapping. The following two statements do the same (as you suggested at the beginning). a,b=b,a=4,5 (a,b),(b,a)=(4,5),(4,5) Best, Sven