For example, I have two class methods in a class, one calling other.
class MyClass(object):
@classmethod
def foo(insert_name_here):
print "foo."
@classmethod
def bar(insert_name_here):
insert_name_here.foo()
c
is obviously too short. Funny words like kind
, myclass
, such
come into my mind, but at the end of the day consistency is the winner.
Is there a PEP standard for this convention?
The convention is to call the class parameter cls
.
See PEP8:
Function and method arguments
Always use
self
for the first argument to instance methods.
Always usecls
for the first argument to class methods.