All jobs / Automation developer

Automation developer interview question · 1–3 years

What is a decorator, really?

The strongest answer

A function that takes a function and returns a replacement — @log above def f is just f = log(f), which is why the wrapper should carry functools.wraps

Why it works

Right, and wraps is the part people leave out until a name or docstring goes missing.

What a good answer covers

Answers that fall short

Who gets asked this

More Automation developer questions