20 lines
581 B
Plaintext
20 lines
581 B
Plaintext
Unlike class and instance methods, static methods don't receive an implicit first argument. Nonetheless naming the first argument ``++self++`` or ``++cls++`` guarantees confusion - either on the part of the original author, who may never understand why the arguments don't hold the values he expected, or on that of future maintainers.
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
class MyClass:
|
|
@staticmethod
|
|
def s_meth(self, arg1, arg2): #Noncompliant
|
|
# ...
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
class MyClass:
|
|
@staticmethod
|
|
def s_meth(arg1, arg2): #Noncompliant
|
|
# ...
|
|
----
|