What this Python language-mechanics question tests
This is a Cracked-difficulty Python question that probes your understanding of mutable default arguments and how CPython handles function definitions. It rewards careful reading of code flow and knowledge of when function defaults are evaluated.
To solve problems like this, you need to trace through object identity and mutation, understand the distinction between assignment and modification, and predict what gets printed based on CPython's execution model. The question tests whether you can reason about subtle but real gotchas that appear in production code.
- Mutable vs. immutable default parameters
- When function defaults are created (definition time vs. call time)
- Reference semantics and object identity
- List mutation and aliasing