Sobes.tech
Junior — Senior

Output the name of the function wrapped by the decorator from inside the decorator

livecode

Task condition

Inside the invert decorator, you need to add output (for example, using print) of the name of the function it takes and wraps. This will allow you to see which function is called when applying the decorator.

from typing import Callable

def invert(func: Callable) -> Callable:
    def wrapper(*args, **kwargs) -> list:
        result = func(*args, **kwargs)
        if isinstance(result, list):
            result = list(map(lambda item: -item, result))
        else:
            raise RuntimeError()
        return result
    return wrapper

After making the change, the decorator will output the name before executing the logic of inverting the result.