do not use self as parameter for static methods


ID: python-best-practices/static-method-no-self

Language: Python

Severity: Error

Category: Best Practices


A static method makes no use of an instance. Therefore, the self argument is not needed nor useful and should not be used.

Non-Compliant Code Examples

class Foo:
  def foo(self, bar):  # no need to use the self argument with a @staticmethod

Compliant Code Examples

class Foo:
  def foo(bar):
     pass jetbrains

Seamless integrations. Try Datadog Code Analysis