
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is Operator in Python
@ symbol is used to define decorator in Python. Decorators provide a simple syntax for calling higher-order functions. By definition, a decorator is a function that takes another function and extends the behavior of the latter function without explicitly modifying it.
we have two different kinds of decorators in Python:
- Function decorators
- Class decorators
A decorator in Python is any callable Python object that is used to modify a function or a class. A reference to a function or a class is passed to a decorator and the decorator returns a modified function or class. The modified functions or classes usually contain calls to the original function.
@decorator def f(argument): ….
will replace f by decorator(f): calling f(argument) is then equivalent to decorator(f)(argument).