Re: [Python-Dev] PEP 572: intended scope of assignment expression

2018-07-05 Thread Ivan Pozdeev via Python-Dev
On 05.07.2018 15:20, Victor Stinner wrote: Hi, My work (*) in the "Assignment expression and coding style: the while True case" thread helped me to understand something about the *intended* scope. While technically, assignment expressions keep the same scoping rules than assignment statements,

Re: [Python-Dev] PEP 572: intended scope of assignment expression

2018-07-05 Thread Victor Stinner
After "Assignment expression and coding style: the while True case", here is the part 2: analysis of the "if (var := expr): ..." case. 2018-07-05 14:20 GMT+02:00 Victor Stinner : > *intended* scope. I generated the giant pull request #8116 to show where I consider that "if (var := expr): ..." wou

Re: [Python-Dev] PEP 572: intended scope of assignment expression

2018-07-05 Thread MRAB
On 2018-07-05 16:07, Victor Stinner wrote: 2018-07-05 15:14 GMT+02:00 Gustavo Carneiro : I don't know if you're trying to propose something clever here, like "if (x := func()):" would assign to 'x' only inside the "then" body of the if, but IMHO that would be a terrible idea: I don't propose t

Re: [Python-Dev] PEP 572: intended scope of assignment expression

2018-07-05 Thread Victor Stinner
2018-07-05 15:14 GMT+02:00 Gustavo Carneiro : > I don't know if you're trying to propose something clever here, like "if (x > := func()):" would assign to 'x' only inside the "then" body of the if, but > IMHO that would be a terrible idea: I don't propose to change the PEP 572. I'm trying to expla

Re: [Python-Dev] PEP 572: intended scope of assignment expression

2018-07-05 Thread Chris Angelico
On Thu, Jul 5, 2018 at 11:14 PM, Gustavo Carneiro wrote: > On Thu, 5 Jul 2018 at 13:43, Victor Stinner wrote: >> >> Hi, >> >> My work (*) in the "Assignment expression and coding style: the while >> True case" thread helped me to understand something about the >> *intended* scope. >> >> While tec

Re: [Python-Dev] PEP 572: intended scope of assignment expression

2018-07-05 Thread Gustavo Carneiro
On Thu, 5 Jul 2018 at 13:43, Victor Stinner wrote: > Hi, > > My work (*) in the "Assignment expression and coding style: the while > True case" thread helped me to understand something about the > *intended* scope. > > While technically, assignment expressions keep the same scoping rules > than a

[Python-Dev] PEP 572: intended scope of assignment expression

2018-07-05 Thread Victor Stinner
Hi, My work (*) in the "Assignment expression and coding style: the while True case" thread helped me to understand something about the *intended* scope. While technically, assignment expressions keep the same scoping rules than assignment statements, writing "if (x := func()): ..." or "while (x