Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-03 Thread Serhiy Storchaka
03.09.19 11:02, Chris Angelico пише: On Tue, Sep 3, 2019 at 5:53 PM Serhiy Storchaka wrote: 02.09.19 12:24, Chris Angelico пише: But the curious difference happens in 3.7. I don't know what changed to cause this, but from there on, the list gets built and then unpacked. This was a side

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-03 Thread Chris Angelico
On Tue, Sep 3, 2019 at 5:53 PM Serhiy Storchaka wrote: > > 02.09.19 12:24, Chris Angelico пише: > > But the curious difference happens in 3.7. I don't know what changed > > to cause this, but from there on, the list gets built and then > > unpacked. > > This was a side effect of moving the

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-03 Thread Serhiy Storchaka
02.09.19 12:24, Chris Angelico пише: But the curious difference happens in 3.7. I don't know what changed to cause this, but from there on, the list gets built and then unpacked. This was a side effect of moving the optimization for `x in [a, b]` from the peepholer to the AST optimizer. --

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-02 Thread Eko palypse
Am Montag, 2. September 2019 00:49:05 UTC+2 schrieb Hongyi Zhao: > Hi, > > What's differences: > > a,b = 2,3 and [a,b] = [2,3] > > Regards In this example the result is the same but the second one builds, internally, an additional list, therefore isn't as sufficient as the

a,b = 2,3 and [a,b] = [2,3]

2019-09-02 Thread Hongyi Zhao
Hi, What's differences: a,b = 2,3 and [a,b] = [2,3] Regards -- https://mail.python.org/mailman/listinfo/python-list

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-02 Thread Chris Angelico
On Mon, Sep 2, 2019 at 6:31 PM Alan Bawden wrote: > > Dang! There is exactly the instruction sequence I just argued could be > optimized away still sitting right there. So maybe my belief that this is > being done by peephole optimization is in fact incorrect? So I went and > tried again: > >

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-02 Thread Alan Bawden
Chris Angelico writes: > On Mon, Sep 2, 2019 at 12:36 PM Alan Bawden wrote: ... > > > > a,b = 2,3 and [a,b] = [2,3] ... > > It looks to me like they generate identical code. The first one calls the > > construction of a tuple, where the second one calls for the

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-01 Thread Chris Angelico
On Mon, Sep 2, 2019 at 12:36 PM Alan Bawden wrote: > > Eko palypse writes: > > > Am Montag, 2. September 2019 00:49:05 UTC+2 schrieb Hongyi Zhao: > > > Hi, > > > > > > What's differences: > > > > > > a,b = 2,3 and [a,b] = [2,3] > &

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-01 Thread Alan Bawden
Eko palypse writes: > Am Montag, 2. September 2019 00:49:05 UTC+2 schrieb Hongyi Zhao: > > Hi, > > > > What's differences: > > > > a,b = 2,3 and [a,b] = [2,3] > > > > Regards > > In this example the result is the same but the second one