bad-staticmethod-argument (PLW0211)#
Derived from the Pylint linter.
This rule is unstable and in preview. The --preview
flag is required for use.
What it does#
Checks for static methods that use self
or cls
as their first argument.
Why is this bad?#
PEP 8 recommends the use of self
and cls
as the first arguments for
instance methods and class methods, respectively. Naming the first argument
of a static method as self
or cls
can be misleading, as static methods
do not receive an instance or class reference as their first argument.
Example#
Use instead: