Skip to content
C

Decorator with functools.wraps

Easypython

Write a decorator @logcall that prints "Calling <function name>" before calling the wrapped function, using @functools.wraps to preserve the original function's metadata, then confirm name_ survives decoration.

Approach: define logcall using functools.wraps(func) inside its wrapper, apply it to a greet(name) function, call greet with the given name, and print greet.name_ afterward.

Input: One line: a name.

Output: Three lines: "Calling greet", "Hello, <name>!", and the decorated function's name ("greet").

Input (stdin)

Output

Run your code to see output here...