0 votes
in Python by
What are Decorators in Python?

1 Answer

0 votes
by

Decorators are evolved from the concept of closures.

A decorator function is a higher order function that takes a function as an argument and returns the inner function.

A decorator is capable of adding extra functionality to an existing function, without altering it.

The decorator function is prefixed with @ symbol and written above the function definition.

Example

@outer

def greet():

   pass

Related questions

0 votes
asked Jun 12, 2020 in Python by Robindeniel
0 votes
asked Oct 12, 2021 in Python by rajeshsharma
...