Show HN: Pre Python 3.15 PEP 661 compat-sentinel
pypi.org
Gets around broken pythonbackport-sentinel
pypi.org
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!