Category: Python Core

Question

[Python Core] Question #28: What are decorators?

Answer

Functions that wrap other functions to extend behavior without modifying the original. Syntax: @decorator above def.

Expand your answer with examples from your projects and link to Interview Prep.

Follow-Up Questions

  • Can you explain a trade-off involved?
  • How would you test this in production?
  • What could go wrong at scale?