Tag: MutableDefaults
-
Best practices: avoid mutable default arguments
Mutable default arguments in Python can lead to unpredictable bugs because they are evaluated once at function definition, not at each call. This post explains why this happens, demonstrates real-world implications, and provides modern best practices, tools, and patterns to avoid these issues safely.
