We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@staticmethod ; def __new__(cls, ...)
ruff check --select=PLW0211 - <<EOF class TestNew: @staticmethod def __new__(cls, title, *args, **kwargs): print(cls) EOF
-:3:17: PLW0211 First argument of a static method should not be named cls
cls
This contradicts https://docs.python.org/3/reference/datamodel.html#basic-customization which uses cls and states that __new__() is a static method.
__new__()
PEP20 statement Explicit is better than implicit. suggests that @staticmethod should be allowed in this code.
Explicit is better than implicit.
@staticmethod
The text was updated successfully, but these errors were encountered:
I think that's a somewhat extreme reading of PEP20! But yes, we should make an exception for __new__ here, which is obviously very special
__new__
Sorry, something went wrong.
pylint
bad-staticmethod-argument
PLW0211
Successfully merging a pull request may close this issue.
This contradicts https://docs.python.org/3/reference/datamodel.html#basic-customization which uses
cls
and states that__new__()
is a static method.PEP20 statement
Explicit is better than implicit.
suggests that@staticmethod
should be allowed in this code.The text was updated successfully, but these errors were encountered: