Why Your Python Functions Are Secretly Changing Data You Never Passed to Them
SMRTR summary
Python's mutable default argument bug silently accumulates state across function calls — because default values are evaluated once at definition time, not per call. A list default like `cart=[]` is stored inside the function object and mutated on every call. The fix: default to `None` and initialize inside the function body. Intentional persistence (like memoization caches) is the one valid exception.
SMRTR provides this summary for quick context. The original article belongs to Hacker Noon.
Read the original article