[issue44123] make function parameter sentinel value true singletons

Tal Einat report at bugs.python.org
Thu May 13 13:38:36 EDT 2021


Tal Einat <taleinat+python at gmail.com> added the comment:

Alternatively, sentinels can simply be classes:

class Sentinel:
    def __new__(cls, *args, **kwargs):
        raise TypeError(f'{cls.__qualname__} cannot be instantiated')

class MISSING(Sentinel):
    pass

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44123>
_______________________________________


More information about the Python-bugs-list mailing list