do not use self as parameter for static methods
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。
ID: python-best-practices/static-method-no-self
Language: Python
Severity: Error
Category: Best Practices
Description
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:
@staticmethod
def foo(self, bar): # no need to use the self argument with a @staticmethod
pass
Compliant Code Examples
class Foo:
@staticmethod
def foo(bar):
pass
Seamless integrations. Try Datadog Code Analysis