python - Convention for "my class" in class method -
for example, have 2 class methods in class, 1 calling other.
class myclass(object): @classmethod def foo(insert_name_here): print "foo." @classmethod def bar(insert_name_here): insert_name_here.foo() c short. funny words kind, myclass, such come mind, @ end of day consistency winner.
what correct convention? or more generally, authoritative source finding such? there pep it?
the convention call class parameter cls.
see pep8:
function , method arguments
always use
selffirst argument instance methods.
useclsfirst argument class methods.
Comments
Post a Comment