On 2021年05月24日 01:37, Luciano Ramalho wrote:
The repr of other singletons are the names of those singletons, eg. "None", so why "<NotGiven>" instead of "NotGiven"?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>.
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 -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/C672ZR7E6AD6KD5UVLUWD3GDQT66VACA/ Code of Conduct: http://python.org/psf/codeofconduct/