Skip to content

Commit 217be66

Browse files
authored
Improve suggested annotations for sentinel types (#14435)
1 parent 7cf443e commit 217be66

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stdlib/_typeshed/__init__.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ MaybeNone: TypeAlias = Any # stable
6565
# In cases where the sentinel object is exported and can be used by user code,
6666
# a construct like this is better:
6767
#
68-
# _SentinelType = NewType("_SentinelType", object)
69-
# sentinel: _SentinelType
68+
# _SentinelType = NewType("_SentinelType", object) # does not exist at runtime
69+
# sentinel: Final[_SentinelType]
7070
# def foo(x: int | None | _SentinelType = ...) -> None: ...
71-
sentinel: Any
71+
sentinel: Any # stable
7272

7373
# stable
7474
class IdentityFunction(Protocol):

0 commit comments

Comments
 (0)