cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

What's the difference between a method and a function?

Kaniz
Community Manager
Community Manager
 
1 REPLY 1

Ryan_Chynoweth
Honored Contributor III

Typically a method is associated to an object and/or class while a function is not.

For example, the following class has a single method called "my_method":

class MyClass():
 
    def __init__(self, a):
        self.a = a
 
 
    def my_method(self):
        return self.a+100

For example, this is a standalone function:

def my_function(value):
    print(value)

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.