-
Notifications
You must be signed in to change notification settings - Fork 271
Open
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations
Description
This came up python/typeshed#3521: Currently I can't think of a way to type sentinel values that are often constructed by allowing a certain instance of object
as the argument. For the example above it would be useful to be able to do something like this:
class PSS(AsymmetricPadding):
MAX_LENGTH: ClassVar[object]
def __init__(self, mgf: MGF1, salt_length: Union[int, Literal[MAX_LENGTH]]) -> None: ...
Alternatively we could add a type like Singleton
type to typing:
class PSS(AsymmetricPadding):
MAX_LENGTH: Singleton
def __init__(self, mgf: MGF1, salt_length: Union[int, MAX_LENGTH]) -> None: ...
jab, SyntaxColoring, Conchylicultor, eigenein, KevinMGranger and 11 more
Metadata
Metadata
Assignees
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations