bpo-37757: https://bugs.python.org/issue37757

This issue describes some corner cases in PEP 572 (assignment expressions) 
syntax that haven’t been implemented yet.  The PEP currently says:

"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’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’s going wrong, without searching the interwebs.

Nick argues (apologies if I’m misrepresenting you!):

"I believe our main motivation for separating it out was the fact that even 
though TargetScopeError is a compile-time error, the affected code is 
syntactically fine - there are just issues with unambiguously inferring the 
intended read/write location for the affected target names. (Subclassing 
SyntaxError is then a pragmatic concession to the fact that "SyntaxError" also 
de facto means "CompilationError”)”

Serhiy points out that we have IndentationError and TabError subclasses of 
SyntaxError, but those feel different to me because the exception names 
themselves are clear and descriptive, and lead to obvious actionable remedies.

Guido then suggests we take the discussion here, thus this email.

It would be a very minor update to the PEP, but I think it’s useful to resolve 
before the last push for PEP 572 implementation gets completed.

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.

Cheers,
-Barry

Attachment: signature.asc
Description: Message signed with OpenPGP

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/FXVSYCTQOTT7JCFACKPGPXKULBCGEPQY/

Reply via email to