-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Incorrect types for keyword.kwlist
and keyword.softkwlist
#9679
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
Comments
keywords.kwlist
and keywords.softkwlist
keyword.kwlist
and keyword.softkwlist
This is probably intentional - these attributes are supposed to be constants, and really shouldn't be modified. Annotating them as |
Thank you! |
Python's test suite shouldn't be an example of valid type-checkable code. In that case perhaps the test should be loosened to |
Okay. I will change it to |
I agree with @TeamSpen210 — these are documented as "sequences" rather than "lists": https://docs.python.org/3/library/keyword.html#keyword.kwlist Trying to alter them at runtime would likely indicate buggy assumptions in a Python program. Better to keep them typed as if they're immutable. |
For some reason,
kwlist
andsoftkwlist
typed asSequence[str]
instead oflist[str]
Corresponding to
Lib/keyword.py
, it's pure lists.The text was updated successfully, but these errors were encountered: