- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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).
- What is operator binding in Python?
- What is tilde (~) operator in Python?
- What is modulo % operator in Python?
- What is function of ^ operator in Python
- What is a dot 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 is correct name of * operator available 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 a Ternary operator/conditional operator in C#?
- What does 'is not' operator do in Python?