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 more information IPython 7.7.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: class A: ...: b = 0 ...: any((b:= i, 0)[1] for i in range(10)) File "<ipython-input-1-22c303b71775>", line 3 any((b:= i, 0)[1] for i in range(10)) ^ TargetScopeError: named expression within a comprehension cannot be used in a class body ``` So, while the name "TargetScopeError" can sound confusing, I think the extended error message could not be more clear and unambiguous. It seems just fine as it is. On Thu, 8 Aug 2019 at 14:02, Barry Warsaw <ba...@python.org> wrote: > 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 > > _______________________________________________ > 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/ >
_______________________________________________ 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/VPFUBLP5KZTDZYBHLF6HFDB6IC3BZB2D/