๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

Python Intermediate

What is Decorator?

A function that modifies or extends the behavior of another function or class without changing its source code.

Decorators use the @decorator_name syntax placed above a function definition. They take a function as input and return a modified version. Common uses include logging, authentication checks, caching, and timing execution.

Built-in decorators include @property, @staticmethod, and @classmethod. Popular third-party decorators include @app.route (Flask) and @login_required (Django).

Related Terms

Django
A high-level web framework that follows the batteries-included philosophy, providing ORM, admin, auth, and more out of the box.
Matplotlib
A comprehensive plotting library for creating static, animated, and interactive visualizations in Python.
Python Descriptors
Objects that define __get__, __set__, or __delete__ methods, controlling how attribute access works on other objects.
Python Interpreter
The program that reads and executes Python code, translating it into machine instructions at runtime.
Python Package
A directory containing Python modules and an __init__.py file, providing a way to organize and distribute reusable code.
NumPy
A fundamental library for numerical computing in Python, providing efficient multi-dimensional arrays and mathematical operations.
View All Python Terms โ†’