What this Python language-knowledge question tests
This is an easy Python question designed to check your understanding of mutable default arguments and how they behave across function calls. It's a classic gotcha that trips up candidates who haven't internalized Python's object model, and firms use it to quickly assess whether you've done real work in the language.
The question asks you to trace through code and predict its output, which means you need to understand how Python handles function defaults at definition time rather than call time, and what happens when you mutate a mutable object that serves as a default parameter. Getting this right requires clarity about object identity, scope, and the timing of default-argument evaluation.
- Mutable vs. immutable types in Python
- When default arguments are evaluated
- Object identity and reference semantics
- Side effects across function calls