What are decorators in python?
![](https://pythonpoint.net/wp-content/uploads/2020/12/Blue-Office-Hacks-YouTube-Thumbnail-4-1024x576.jpg)
Python has many interesting features one of them are decorators. Decorators are used to define a function inside a function.
It is used to add some functionality in a function and then return it.
e.g.,
def demo(num): print(num) demo("25") demo=deco deco("25")
![](https://pythonpoint.net/wp-content/uploads/2020/12/Screenshot-938-1024x363.png)
output- 25 25
This is how we use decorator in python.
Subscribe
Login
Please login to comment
0 Discussion