r/Python • u/[deleted] • Jul 22 '21
Resource Do not use mutable objects as default arguments in Python
https://medium.com/geekculture/do-not-use-objects-as-default-arguments-in-python-1c940212db2e
1.3k
Upvotes
r/Python • u/[deleted] • Jul 22 '21
0
u/Caboose522 Jul 22 '21
It doesnt read well I agree, and in this case it probably wouldnt give any performance advantage. I like the concept though and I could think of other situations where this could make sense. The cool thing is if you grasp it you can use it to write more succinctly, and less code is usually a good thing.