I'm designing one class for common library.
This class method called sequencially like below.
call order is 'class method' -> 'instance method' -> 'instance method'
I don't know why last instance method need self parameter..
Ordinally instance method does not need self method as we know.
What am I missing?
class A:
@classmethod
def first(cls):
print('cls method')
cls.second(cls)
def second(self):
print('inst method 1')
self.third(self) # Question! Why this method need [self] parameter?
def third(self):
print('inst method 2')
A.first()
secondas a class method. If you want to call it with a class rather than a class instance, then make it a@classmethod. Forthird, if it doesn't need a class or a class instance, then make it a@staticmethod.