So I know that "mutable default arguments" are a 'feature' of Python that can often cause unexpected behaviour (there's an interesting Stack Overflow page about here: "Least Astonishment" and the Mutable Default Argument).
And I know that the usual solution is to set arg=None in the function signature, and then set the value within the function, like if arg is None: arg = [] #or whatever (cf. What is the pythonic way to avoid default parameters that are empty lists?, Why does using `arg=None` fix Python's mutable default argument issue?).
But what if I want to allow None to be explicitly specified? I could use a string that explains what we're doing, ie. make the default arg='none_specified', and then do if arg=='unspecified': arg = []. But that seems a little ugly.
Is there a Pythonic solution to this?