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 self first argument instance methods.
use cls first argument class methods.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -