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


Groups > comp.lang.python > #95894 > unrolled thread

Re: packing unpacking depends on order.

Started by"Sven R. Kunze" <srkunze@mail.de>
First post2015-09-02 22:14 +0200
Last post2015-09-02 22:14 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: packing unpacking depends on order. "Sven R. Kunze" <srkunze@mail.de> - 2015-09-02 22:14 +0200

#95894 — Re: packing unpacking depends on order.

From"Sven R. Kunze" <srkunze@mail.de>
Date2015-09-02 22:14 +0200
SubjectRe: packing unpacking depends on order.
Message-ID<mailman.34.1441225187.8327.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web