๐ŸŽ 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

Uvicorn
A lightning-fast ASGI server for Python, commonly used to serve FastAPI and other async web applications.
Python Iterator Protocol
The interface requiring __iter__() and __next__() methods, enabling objects to be used in for loops and other iteration contexts.
Logging Module
Python's built-in module for recording diagnostic information with configurable handlers, formatters, and log levels.
NumPy
A fundamental library for numerical computing in Python, providing efficient multi-dimensional arrays and mathematical operations.
Flask
A lightweight web framework for Python that provides essentials for building web applications without imposing structure.
Pydantic
A data validation library that uses Python type annotations to validate and serialize data with automatic error reporting.
View All Python Terms โ†’