Why Mutable Default Arguments Are Structurally Dangerous in Python
카테고리 없음·2025. 12. 20.
Why Mutable Default Arguments Are Structurally Dangerous in PythonMutable default arguments are one of the most persistent sources of surprise in Python. A function appears to start with a clean default value, yet state leaks across calls.The behavior looks like a bug. Each invocation feels independent. The function body does not obviously store global state.Despite this, lists grow unexpectedly..