Coding Now – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 9667708830
Home Community What is a Python decorator and how do you use it?

What is a Python decorator and how do you use it?

Coding Now Expert  •  Jun 13, 2026  •  167 views
A decorator is a function that wraps another function to extend its behaviour without modifying it.

```python
def my_decorator(func):
def wrapper():
print('Before')
func()
print('After')
return wrapper

@my_decorator
def say_hello():
print('Hello!')
```

Common use cases: logging, authentication, caching, timing.
0

0 Answers

Your Answer

Will not be displayed publicly
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →