culTest

    One of the 50 questions in this topic

    How much do you know about Python?

    What is a decorator in Python?

    Answers

    A function that modifies the behavior of another functionCorrect
    A class for designing graphical interfaces
    A special type of comment
    A tool for formatting code

    A decorator is a function that modifies the behavior of another function, method, or class without changing its internal code. They are applied using the @decorator_name syntax before definition. Decorators implement the Decorator design pattern and are useful for adding functionality such as logging, timing, access control, or caching to existing functions.