Closed llucax closed 1 week ago
Skipping release notes check as there is no release yet, we'll write the notes when the first release is out.
I tried several alternatives and couldn't make it work with a reasonable syntax, so I guess we need to wait for the official support.
I tried other more old school implementations and they all suck, I guess the best approach for now is still to just do class Sentinel: pass; SENTINEL = Sentinel()
, at least until this gets implemented, then at least we can use Literal
with SENTINEL: Final = object()
and accept Literal[SENTINEL]
as argument, which seems still reasonable:
I think I will close for now.
Introduce a new module for creating unique sentinel objects according to PEP661.
This is based in the reference implementation in https://github.com/taleinat/python-stdlib-sentinels (commit 410273e40bdbd1b58a63cebefdf8abcce6c620e3), and adapted to match this repository documentation standards and linting tools.