Possible Duplicate:
Is there any way to know if the value of an argument is the default vs. user-specified?
python - returning a default value
It is standard practice in Python to use None
as the default parameter value.
However, this idiomatic usage doesn't work well if client code may use None
as a legal argument value. In this case, the function cannot tell whether the client code omitted the argument, or whether it explicitly passed None
. This is not good, unless (by luck) the function's behavior should be the same in both cases.
What is a good solution?