mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Improve suggested annotations for sentinel types (#14435)
This commit is contained in:
@@ -65,10 +65,10 @@ MaybeNone: TypeAlias = Any # stable
|
||||
# In cases where the sentinel object is exported and can be used by user code,
|
||||
# a construct like this is better:
|
||||
#
|
||||
# _SentinelType = NewType("_SentinelType", object)
|
||||
# sentinel: _SentinelType
|
||||
# _SentinelType = NewType("_SentinelType", object) # does not exist at runtime
|
||||
# sentinel: Final[_SentinelType]
|
||||
# def foo(x: int | None | _SentinelType = ...) -> None: ...
|
||||
sentinel: Any
|
||||
sentinel: Any # stable
|
||||
|
||||
# stable
|
||||
class IdentityFunction(Protocol):
|
||||
|
||||
Reference in New Issue
Block a user