r/Python • • 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

218 comments sorted by

View all comments

Show parent comments

1

u/jet_heller Jul 22 '21

I'm sorry you think something specifically left in there by the language designers is a hack. It's not.

1

u/diamondketo Jul 22 '21

Not every behavior is an explicit design choice. Not every bad practice behavior can be fixed either (e.g., backward compatiblility).

2

u/jet_heller Jul 22 '21

So, they have to keep this bad hack in so they don't break anyone who's using this bad hack. That seems very illogical.