3 ms·
I believe the idiom to check, if a parameter wasn’t set is to use an object() instance as default value. _notset = object() def foo(x=_notset): if x
by vasachi 6y ago
I believe the idiom to check, if a parameter wasn’t set is to use an object() instance as default value.
_notset = object()
def foo(x=_notset):
if x is _notset:
print("foo was called as foo()")