So while it's a footgun you will be writing some weird code to actually trigger it.
So while it's a footgun you will be writing some weird code to actually trigger it.
Seems fine to me. If the default expression causes side effects, then that's what I would expect.
>This kind of function is fine in Python because it's unidiomatic to mutate your parameters, you do obj.mutate() not mutate(obj).
I first wrote Python over 10 years ago and I never learned this.
How would you idiomatically write a function/method which mutates >1 parameter?
A common case where you would have a free function which mutates its parameter would be a function which takes a file handle but it's also the case that you wouldn't have a mutable default for this value.
If you want to mutate two parameters just pass them to a function like you normally would.
It's sloppy and a bad habit, I would not let it pass a PR in production code. Probably OK for a throwaway script.