[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Joao S. O. Bueno
I just read your e-mail (before reading any follow up here), fired up Python 3.8 and typed in what I thought would be an ambiguous or confuse case, withut checking the PEP. the result: ``` Python 3.8.0b3+ (heads/3.8:ef0b81927a, Aug 6 2019, 20:30:57) Type 'copyright', 'credits' or 'license' for mo

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Guido van Rossum
On Fri, Aug 9, 2019 at 8:07 PM Chris Angelico wrote: > On Sat, Aug 10, 2019 at 12:56 PM Guido van Rossum > wrote: > > > > On Fri, Aug 9, 2019 at 11:06 AM Barry Warsaw wrote: > >> > >> Nick and I are now on the same page, so I don’t think we *have* to have > a formal SC vote. > > > > > > OK, I a

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Chris Angelico
On Sat, Aug 10, 2019 at 12:56 PM Guido van Rossum wrote: > > On Fri, Aug 9, 2019 at 11:06 AM Barry Warsaw wrote: >> >> Nick and I are now on the same page, so I don’t think we *have* to have a >> formal SC vote. > > > OK, I agree. Let's remove TargetScopeError from the PEP and from the > implem

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Guido van Rossum
On Fri, Aug 9, 2019 at 11:06 AM Barry Warsaw wrote: > Nick and I are now on the same page, so I don’t think we *have* to have a > formal SC vote. > OK, I agree. Let's remove TargetScopeError from the PEP and from the implementation. Since that makes three SC members in favor the motion passes. I

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Greg Ewing
Steven D'Aprano wrote: I find it difficult to imagine a more meaningful distinction than that between syntax and semantics. That may be so, but when specifying a programming language, there is often some flexibility as to whether language rules are considered part of the syntax or the semantics

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Barry Warsaw
Nick and I are now on the same page, so I don’t think we *have* to have a formal SC vote. Cheers, -Barry > On Aug 9, 2019, at 08:28, Guido van Rossum wrote: > > I don't see how this debate can avoid a vote in the Steering Council. > > -- > --Guido van Rossum (python.org/~guido) > Pronouns: he

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Barry Warsaw
Thanks Nick. I find yours (and Eric’s) argument compelling. I’m totally aligned with using SyntaxError in 3.8 and thinking through the more general problem for 3.9. Cheers, -Barry > On Aug 9, 2019, at 06:44, Nick Coghlan wrote: > > Short version of my more detailed answer below: > > While

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Nick Coghlan
On Sat, 10 Aug 2019 at 02:05, Eric V. Smith wrote: > > On 8/9/2019 11:41 AM, Tim Peters wrote: > > [Guido] > >> I don't see how this debate can avoid a vote in the Steering Council. > > > > FWIW, I found Nick's last post wholly persuasive: back off to > > SyntaxError for now, and think about addi

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Christian Tismer
On 09.08.19 15:44, Nick Coghlan wrote: ... > However, a change like that would make the most sense when considered > independently of the specific case of assignment expressions - > instead, we would want to ask "What kinds of exceptions does the > symbol table analysis pass raise?", and then cons

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Eric V. Smith
On 8/9/2019 11:41 AM, Tim Peters wrote: [Guido] I don't see how this debate can avoid a vote in the Steering Council. FWIW, I found Nick's last post wholly persuasive: back off to SyntaxError for now, and think about adding a more specific exception later for _all_ cases (not just walrus) in

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Tim Peters
[Guido] > I don't see how this debate can avoid a vote in the Steering Council. FWIW, I found Nick's last post wholly persuasive: back off to SyntaxError for now, and think about adding a more specific exception later for _all_ cases (not just walrus) in which a scope conflict isn't allowed (e.g.

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Guido van Rossum
I don't see how this debate can avoid a vote in the Steering Council. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him/his **(why is my pronoun here?)* ___

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Rob Cliffe via Python-Dev
On 09/08/2019 12:50:14, Steven D'Aprano wrote: On Thu, Aug 08, 2019 at 04:28:28PM -0700, Barry Warsaw wrote: I find it difficult to imagine a more meaningful distinction than that between syntax and semantics. The distinction between syntax and semantics can sometimes be blurred. Certainly in

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Nick Coghlan
Short version of my more detailed answer below: While my rationale is different from Barry's, I've convinced myself that the right thing to do for Python 3.8 is to remove the new TargetScopeError and have these cases all just raise SyntaxError. I do still see potential value in a new "AssignmentS

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Steven D'Aprano
On Thu, Aug 08, 2019 at 04:28:28PM -0700, Barry Warsaw wrote: > On Aug 8, 2019, at 14:58, Steven D'Aprano wrote: > > > It's not a syntax error. There's nothing wrong with the syntax per-say: > > we still have ``target := expression``. There's a problem with the > > *semantics* not the syntax. >

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Steven D'Aprano
On Fri, Aug 09, 2019 at 01:16:16AM +0100, Rob Cliffe via Python-Dev wrote: > >The name is perfectly self-descriptive: TargetScopeError means that > >there's an error with the scope of the target. What else could it mean? > That's easy for an experienced programmer to say. Correct. Why should we

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-09 Thread Christian Tismer
On 09.08.19 03:53, Eric V. Smith wrote: > On 8/8/2019 7:28 PM, Barry Warsaw wrote: >> On Aug 8, 2019, at 14:58, Steven D'Aprano wrote: >> >>> It's not a syntax error. There's nothing wrong with the syntax per-say: >>> we still have ``target := expression``. There's a problem with the >>> *semantic

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Serhiy Storchaka
08.08.19 20:00, Barry Warsaw пише: Rather than just a vote, if you have a rationale for one over the other, I’d love to hear it. Feel free to weigh in here or on the issue. I do not have arguments for SyntaxError but the rationale for TargetScopeError does not look strong to me. IndentationE

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Eric V. Smith
On 8/8/2019 7:28 PM, Barry Warsaw wrote: On Aug 8, 2019, at 14:58, Steven D'Aprano wrote: It's not a syntax error. There's nothing wrong with the syntax per-say: we still have ``target := expression``. There's a problem with the *semantics* not the syntax. I’m not sure that distinction is me

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Rob Cliffe via Python-Dev
On 08/08/2019 22:58:15, Steven D'Aprano wrote: On Thu, Aug 08, 2019 at 10:00:01AM -0700, Barry Warsaw wrote: "The two invalid cases listed above raise TargetScopeError, a new subclass of SyntaxError (with the same signature).” The PEP doesn’t really go into the rationale for why a new except

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Barry Warsaw
On Aug 8, 2019, at 14:58, Steven D'Aprano wrote: > It's not a syntax error. There's nothing wrong with the syntax per-say: > we still have ``target := expression``. There's a problem with the > *semantics* not the syntax. I’m not sure that distinction is meaningful though. What you wrote is di

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Greg Ewing
Barry Warsaw wrote: Subclassing SyntaxError is then a pragmatic concession to the fact that "SyntaxError" also de facto means "CompilationError” Perhaps there should be a CompilationError tghat SyntaxError and TargetScopeError are subclasses of? -- Greg

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Steven D'Aprano
On Thu, Aug 08, 2019 at 10:00:01AM -0700, Barry Warsaw wrote: > "The two invalid cases listed above raise TargetScopeError, a new > subclass of SyntaxError (with the same signature).” > > The PEP doesn’t really go into the rationale for why a new exception > is being defined, and in the issue I

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Kyle Stanley
Barry Warsaw wrote: > The PEP doesn’t really go into the rationale for why a new exception is being > defined, > and in the issue I’ve argued that we should just raise SyntaxError in those > cases. To me, > “TargetScopeError” is pretty obscure and doesn’t give users an obvious clue > as to what

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Brett Cannon
I agree that it should be a SyntaxError as it's a semantic issue regarded to syntax. For instance, we already use SyntaxError for when a `return` statement is outside of a function and I view this as the same sort of error. And I think with an appropriately descriptive message like Ivan pointed

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Ivan Pozdeev via Python-Dev
On 08.08.2019 20:54, Barry Warsaw wrote: On Aug 8, 2019, at 10:41, Tim Peters wrote: Whereas SyntaxError would give no clue whatsoever, and nothing useful to search for. In contrast, a search for TargetScopeError would presumably find a precisely relevant explanation as the top hit (indeed, i

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Chris Angelico
On Fri, Aug 9, 2019 at 4:00 AM Barry Warsaw wrote: > > On Aug 8, 2019, at 10:41, Tim Peters wrote: > > > Whereas SyntaxError would give no clue whatsoever, and nothing useful > > to search for. In contrast, a search for TargetScopeError would > > presumably find a precisely relevant explanation

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Barry Warsaw
On Aug 8, 2019, at 10:41, Tim Peters wrote: > Whereas SyntaxError would give no clue whatsoever, and nothing useful > to search for. In contrast, a search for TargetScopeError would > presumably find a precisely relevant explanation as the top hit > (indeed, it already does today). > > I don't

[Python-Dev] Re: PEP 572 TargetScopeError

2019-08-08 Thread Tim Peters
[Barry Warsaw ] > bpo-37757: https://bugs.python.org/issue37757 Really couldn't care less whether it's TargetScopeError or SyntaxError, but don't understand the only rationale given here for preferring the latter: > To me, “TargetScopeError” is pretty obscure and doesn’t give users an > obvious c