Nice! I've a sentinel for my own project, but it's a simple class Default: def __repr__(self): return "<use default>") default = Default() so I need to do: def f(a: Union[int, None, Default] = default): if a is default: .. to get the typing right, from 3.10 onward. Why I saw the info about the new sentinel, I wondered how they could manage using a '|default' with simply the sentinel. I see from your code's _union() that it's a bit tricky to make 3.10 even support Union[int, None, default]. Thanks for pointing to the project!
Open pypi.orgpypi.org/project/compat-sentinel
compat-sentinel
A Python package providing a backport of PEP 661 sentinels for compatibility with Python versions before 3.15.
Visit project- First shared
- Oct 10, 2026
- HN activity
- 62
Show HN@owebeeoneOct 10, 2026
Show HN: Pre Python 3.15 PEP 661 compat-sentinel
Gets around broken pythonbackport-sentinel
Community