in Python by
Q:
What are decorators in Python?

1 Answer

0 votes
by

Decorators in Python are used to modify behaviours of functions. For example, if you want to log all calls to a particular set of functions, cache its parameters and return values, perform benchmarks, etc.

Decorators are prefixed with the @ symbol and placed right before function declaration:

@my_decorator

def func1():

    pass

Click here to read more about Python
Click here to read more about Insurance

Related questions

0 votes
asked Jun 12, 2020 in Python by Robindeniel
0 votes
asked Jan 1 in Python by SakshiSharma
0 votes
asked Aug 30, 2020 in Python by sharadyadav1986
0 votes
asked Jun 30, 2020 in Python by GeorgeBell
0 votes
asked Jun 12, 2020 in Python by Robindeniel
...