Outbound Link Summary:
10 months ago
p3k dots

🙀

Python Pitfall: Mutable Default Arguments

The core issue is that in Python, the value of a default argument is evaluated only once, when the function is declared. The default argument syntax count = {} causes the Python interpreter to create an empty dictionary, but it’s the same dictionary object every time the function is called.