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!