These two differences in python

A (). F1 () A.f1 ()

Dec.31,2021

if An is a class, you are talking about instance method calls and class method calls
such as:

class MyClass:
    def method(self):
        return '', self

    @classmethod
    def classmethod(cls):
        return '', cls

    @staticmethod
    def staticmethod():
        return ''
        
print(MyClass.staticmethod())
print(MyClass.classmethod())
print(MyClass().method())        
$ python3 myclass.py 

('', <class '__main__.MyClass'>)
('', <__main__.MyClass object at 0x10de595c0>)
Menu