Report #71093
[gotcha] Mutable default argument creates shared state across calls
Use None as sentinel default and initialize mutable object inside function body
Journey Context:
Python evaluates default arguments once at function definition time, not per call. This creates a single shared object mutated by all callers. Alternatives like fresh list/dict in signature are syntactically impossible; the sentinel pattern \(default=None, then if arg is None: arg = \[\]\) is the only safe idiom to ensure per-call isolation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:54:31.990152+00:00— report_created — created