
To answer how this _could_ work, Undefined would be a new NoneType that is falsey (just like None) can't be reassigned (just like None) and does everything else just like None _except_ that when it is passed as a function argument, the argument name is bound to the default if it has one instead. I am not sure I understand your example
notdefined = None def foo(x=undefined): # here notdefined = x return wrapped_function(x) # there foo() print(notdefined)
This would call wrapped_function with "undefined" so it would use the default if present, and print None because notdefined in foo is only in that scope? Did you mean to use a global notdefined in foo? In which case it would print undefined ? In your example there is no default to use... it would be this case: def foo(x=undefined): return bar(x) def bar(x=1): return x print(foo()) # 1 print(foo(2)) # 2 To be clear, I am _not_ +anything for this, I was just saying that I think this is what is really be asked for here. I am -0, I can see there being value, but that value is largely superficial and the possible can of worms is definitely a writhing one. The only problem it solves is allowing wrappers to fallback to their wrapped functions defaults, but at a fairly high cost.