[issue44838] SyntaxError: New message "expected 'else' after 'if' expression" wrongly shown

Pablo Galindo Salgado report at bugs.python.org
Thu Aug 5 12:40:57 EDT 2021


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

Technically this example si more or less equivalent to:

[ something, blech

if 42:
   True

[Bluch]]

I wonder if the better fix here is just not to raise the rule if we find a ':', which is the only token that actually makes sense after 

'if' expression

----------

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


More information about the Python-bugs-list mailing list