I found the way to replace sentinel between 3.12 to 3.14:
type _MISSING = _MISSING
def my_func(need_value: int, not_need_value: str | _MISSING = _MISSING) -> None:
if not_need_value is _MISSING:
print(f"No 'not_need_value'. The 'need_value' is {need_value}")
return
print(f"'not_need_value' is {not_need_value} and 'need_value' is {need_value}")
The behavior in runtime is great. The only question is that type checking doesn’t think that it is OK. So is it the great way to create the sentinel value?