🎁 New User? Get 20% off your first purchase with code NEWUSER20 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

Python ABC Module
The Abstract Base Classes module that enables defining interfaces and abstract methods that subclasses must implement.
Python Logging Best Practices
Structured approaches to implementing logging in Python applications using the built-in logging module for debugging and monitoring.
Pandas
A powerful data analysis and manipulation library providing DataFrames and tools for working with structured data.
Python Property
A built-in decorator that lets you define methods that behave like attributes, enabling controlled access to instance data.
Enum
A built-in class for creating enumerated constants — named groups of related values that improve code readability.
Celery
A distributed task queue for Python that enables asynchronous processing of background jobs and scheduled tasks.
View All Python Terms →