On this page
article
Tip #23: Never use mutable default arguments
Python tip #23: Never use mutable default arguments.
Tip
Never use mutable default arguments
Why
Following this practice makes your Python code more readable, maintainable, and less error-prone.
Example
# Before (avoid)
# ... less idiomatic approach ...
# After (prefer)
# ... idiomatic Python 3.10+ approach ...