Q&A
Q&AWhy is a mutable default argument dangerous in Python?
Default expressions are evaluated once, so the same mutable object is reused across calls.
Read the concise answer
A default list or dictionary is created when the function is defined, not every time it is called. Mutations therefore leak between calls. Use None as a sentinel and construct a fresh object inside, or use default_factory for dataclasses and similar models.