Below is a simple class, which is having one method/function in it
class Test():
def f(self):
return "function or method"
What should I call f()
here - a method or a function?
Below is a simple class, which is having one method/function in it
class Test():
def f(self):
return "function or method"
What should I call f()
here - a method or a function?
From python official document's glossary:
method
A function which is defined inside a class body. If called as an attribute of an instance of that class, the method will get the instance object as its first argument (which is usually called self). See function and nested scope.