QUESTION 9 OF 15

How do decorators work in Python?

Reveal the answer and explore the explanation.

09
Hard

How do decorators work in Python?

Answer
Answer

Callable that wraps or transforms a function or class at definition time.

Practical example

Add timing around a model inference function.

Reference: Further reading ↗

Last 30 min revisionHigh-yield interview Q&As