DEV Community

Discussion on: Python Mutable Defaults Are The Source of All Evil

Collapse
 
florimondmanca profile image
Florimond Manca • Edited

Yep, that would solve it if your argument can be transformed to use a non-mutable version.
However, Python is already so confusing on types that I wouldn’t recommend providing a tuple if you’re to use a list afterwards.
I like to use type annotations, so annotating an argument as a List while providing an empty tool for the default would look suspicious. ;)