What do these mean of: @classmethod and @staticmethod

Last updated:9/17/2020 4:05:58 AM

1 Answers

Prakash nidhi Verma
Prakash nidhi Verma

These are decorators. A decorator is a special kind of function that either takes a function and returns a function, or takes a class and returns a class. The @ symbol is just syntactic sugar that easy in read. 

@my_decorator 
def my_func(stuff):
    do_things
def my_func(stuff):

    do_things
my_func = my_decorator(my_func)

Answer