[issue43797] Improve syntax error for invalid comparisons

Pablo Galindo Salgado report at bugs.python.org
Sat Apr 10 14:08:48 EDT 2021


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

> in invalid_named_expression, but it does not have any effect.

That is because the rule for named_expressions are:

 named_expression[expr_ty]:
     | a=NAME ':=' ~ b=expression
     | expression !':='
     | invalid_named_expression

and the second alternative (| expression !':=') succeeds with an assignment, not letting the invalid_named_expression run

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43797>
_______________________________________


More information about the Python-bugs-list mailing list