Let's say you have a class ClassA which contains a method methodA defined as:
ClassA
methodA
def methodA(self, arg1, arg2): # do something
and ObjectA is an instance of this class.
ObjectA
Now when ObjectA.methodA(arg1, arg2) is called, python internally converts it for you as:
ObjectA.methodA(arg1, arg2)
ClassA.methodA(ObjectA, arg1, arg2)
The self variable refers to the object itself.
self
Sign in to make a reply
confused235
Let's say you have a class
ClassA
which contains a methodmethodA
defined as:and
ObjectA
is an instance of this class.Now when
ObjectA.methodA(arg1, arg2)
is called, python internally converts it for you as:The
self
variable refers to the object itself.