from the docs,
the special thing about methods is that the instance object is passed as the first argument of the function. In our example, the call
x.f()
is exactly equivalent toMyClass.f(x)
. In general, calling a method with a list of n arguments is equivalent to calling the corresponding function with an argument list that is created by inserting the method’s instance object before the first argument.
preceding this the related snippet,
class MyClass:
"""A simple example class"""
i = 12345
def f(self):
return 'hello world'
x = MyClass()