You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-08-02.19:05:42.925>created_at=<Date2021-07-31.11:25:20.977>labels= []
title='Improve syntax errors for invalid if expressions'updated_at=<Date2021-08-02.19:05:43.048>user='https://github.com/miguendes'
Hi, I was playing around with Python's grammar and noticed that the error message for if expression is generic, so not very informative.
I decided to improve it slightly.
*From*:
>>> a = 42 if True
File "<stdin>", line 1
a = 42 if True
^
SyntaxError: invalid syntax
*To*:
$ ./python
Python 3.10.0b4 (tags/v3.10.0b4-dirty:2ba4b20854, Jul 31 2021, 11:50:15) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 42 if True
File "<stdin>", line 1
a = 42 if True
^
SyntaxError: invalid syntax. Conditional expression expected an 'else' here.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: