-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lambda expression no longer valid at comp_if in Python 3.9 #87921
Comments
According to the documentation, a lambda expression at the user@host:/$ python3.8
Python 3.8.9 (default, Apr 3 2021, 01:00:00)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> [x for x in range(10) if lambda: 1]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>>
user@host:/$ python3.9
Python 3.9.3 (default, Apr 3 2021, 00:51:37)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> [x for x in range(10) if lambda: 1]
File "<stdin>", line 1
[x for x in range(10) if lambda: 1]
^
SyntaxError: invalid syntax |
This looks like a duplicate of https://bugs.python.org/issue41848 |
OK I didn't find this duplicate issue. After reading that, I think we should update the documentation (https://docs.python.org/3/reference/expressions.html). |
Oh, nice improvement suggestion for the docs! Do you feel comfortable submitting a small PR for that? |
I'll work on it soon. |
Thanks for the quick fix, Saiyang Gou |
comp_if
since 3.9 #25231comp_if
since 3.9 (GH-25231) #25233Note: 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: