Sobes.tech
Junior — Senior

Creating a decorator that checks if a function returns a string

livecode

Task condition

Write a decorator returns_string that, after executing a function, checks that its result is of type str. If the obtained value is not a string, the decorator should raise a TypeError exception. The decorator must preserve the original function's name and docstring, and also work correctly with functions accepting an arbitrary number of positional and keyword arguments.

Creating a decorator that checks if a function… - sobes.tech