Python calling method without ‘self’

Also you can make methods in class static so no need for self. However, use this if you really need that.

Yours:

class bla:
    def hello(self):
        self.thing()

    def thing(self):
        print "hello"

static edition:

class bla:
    @staticmethod
    def hello():
        bla.thing()

    @staticmethod
    def thing():
        print "hello"

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)