A decorator in Python is a design pattern used to add new functionality to an object without altering its ____.
- attributes
- class
- methods
- structure
In Python, decorators are typically used to add new functionality to methods of a class without changing the method's name or signature. This is commonly used for tasks like logging, authorization, and caching.
Loading...
Related Quiz
- To define a generator, you use the ____ keyword in the function definition.
- How would you initialize an empty list in Python?
- A ____ sort is a highly efficient sorting algorithm based on partitioning of an array of data into smaller arrays.
- How can you create class methods that cannot be overridden by subclasses?
- A ____ is a type of binary tree where the tree automatically balances itself as items are inserted or removed.