Because Python has both functions AND methods, let's look into the key differences between the two.

Python MethodsEdit

A method is a function that is a member of a class. For example:

class SomeClass:
    def someMethod(self):
        print("Hello! I am a member of SomeClass.")

thing = SomeClass()

Key FeaturesEdit

  1. Methods are called by name, but it is associated to an object (dependent).
  2. A method is implicitly passed the object on which it is invoked.
  3. It may or may not return any data.
  4. A method can operate on the data (instance variables) that is contained by the corresponding class.

Python FunctionsEdit

A function is a block of code which only runs when it is called.

You can pass data, known as parameters, into a function. And a function can return data as a result. For example:

def someFunction(name):
    print("Hello %s!" % name)


# Returns:
Hello Renee!

Key FeaturesEdit

  1. A function is a block of code that is also called by its name (independent).
  2. The function can have different parameters or may not have any at all. If any data (parameters) are passed, they are passed explicitly.
  3. It may or may not return any data.
  4. Functions do not deal with Classes and the concept of instances.


What is a "method" in Python? - stackoverflow

Difference between Method and Function in Python - GeeksforGeeks

Python Functions -

Community content is available under CC-BY-SA unless otherwise noted.