
July 27, 2022
4:57 p.m.
Mathew Elman writes:
To answer how this _could_ work, Undefined would be a new NoneType
My example is intended to refer specifically to the alternative semantics where 'undefined' is not allowed outside of function prototypes (or other specified contexts, for that matter). The point of the example is that it will be possible to capture that singleton and use it anywhere by a different name. And you just know that somebody will find a reason to do it.
I am not sure I understand your example
notdefined = None def foo(x=undefined): # here notdefined = x
You're right, this should be "global notdefined; notdefined = x".
return wrapped_function(x) # there foo() print(notdefined)
What does that print? Or does it error?