On 2021-05-24 01:37, Luciano Ramalho wrote:
Sorry about my detour into the rejected idea of a factory function.

But how about this class-based API?

class NotGiven(Sentinel):
     pass


Now I can use NotGiven as the sentinel, and its default repr is <NotGiven>.

The repr of other singletons are the names of those singletons, eg. "None", so why "<NotGiven>" instead of "NotGiven"?

Behind the scenes we can have a SentinelMeta metaclass with all the
magic that could be required--including the default __repr__ method.

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

Reply via email to