Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.093 X-Spam-Evidence: '*H*': 0.81; '*S*': 0.00; '[1,': 0.09; 'backwards': 0.09; 'thread': 0.10; 'python': 0.10; 'reedy': 0.16; 'wrote:': 0.16; 'handles': 0.20; 'am,': 0.23; 'second': 0.24; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'cases.': 0.29; "i'm": 0.30; 'received:10.0': 0.34; 'gets': 0.35; 'so,': 0.35; 'best,': 0.35; 'but': 0.36; 'should': 0.36; 'possible': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'really': 0.37; 'to:addr:python.org': 0.40; 'still': 0.40; 'received:de': 0.40; 'your': 0.60; 'avoid': 0.61; 'charset:windows-1252': 0.62; 'more': 0.63; '>>>>>': 0.66; 'results': 0.66; 'construction': 0.72; 'pardon': 0.84 Date: Wed, 02 Sep 2015 22:14:27 +0200 From: "Sven R. Kunze" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: packing unpacking depends on order. References: <55E6C904.3020602@rece.vub.ac.be> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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: 892 X-purgate-ID: 154282::1441224869-00000778-8BA0E108/0/0 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441225187 news.xs4all.nl 23835 [2001:888:2000:d::a6]:45595 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95894 On 02.09.2015 19:42, Terry Reedy wrote: > On 9/2/2015 6:01 AM, Antoon Pardon wrote: >> >>>>> a = [1, 2, 3, 4, 5] >>>>> b = 1 >>>>> b, a[b] = a[b], b >>>>> a >> [1, 2, 1, 4, 5] >>>>> a = [1, 2, 3, 4, 5] >>>>> b = 1 >>>>> a[b], b = b, a[b] >>>>> a >> [1, 1, 3, 4, 5] >> >> I think I understand how it gets these results >> but I'm not really happy with them. I think python >> should give the second result in both cases. > > I do not want the choice taken away from me. > I do as readability and maintainability comes first for me. Btw. you would still be able to perform your choice but more explicitly. However, I fear this would be a very hard break of backwards compatibility. :/ So, what I take away from this thread right now is that one should avoid this type of construction whenever possible as long as Python handles it that way. Best, Sven