
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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).
- Related Questions & Answers
- What is tilde (~) operator in Python?
- What is modulo % operator in Python?
- What is operator binding in Python?
- What is a dot operator in Python?
- What is function of ^ operator in Python
- What is "is not" operator in Python?
- What is Python equivalent of the ! operator?
- What is "not in" operator in Python?
- What does 'is' operator do in Python?
- What is right shift (>>) operator in Python?
- What is the purpose of the `//` operator in python?
- What is vertical bar in Python bitwise assignment operator?
- What is correct name of * operator available in Python?
- What is a Ternary operator/conditional operator in C#?
- What does 'is not' operator do in Python?
Advertisements