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?

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/37546QCEKSRTDZR2GODKKX4JFQDGQ7B4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to