Imagine we have a class with three methods defined:
class MyClass:
def instance_method(self):
return "Instance method called", self
@classmethod
def class_method(cls):
return "Class method called", cls
@staticmethod
def static_method():
return "Static method called"
We instantiate it and call the instance method:
obj1 = MyClass()
obj1.instance_method()
# --> ('Instance method called', <__main__.MyClass at 0x106634588>)
And then we call the class method:
obj1.class_method()
# --> ('Class method called', __main__.MyClass)
I'm having trouble understanding why the instance method is bracketed by '<>', and why it contains a pointer to a location in memory when the class method does not.