-
Notifications
You must be signed in to change notification settings - Fork 278
Closed as not planned
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations
Description
Problems:
- You want define a type that is not possible to define in python at the moment of writing.
- You can define a type but you choose to defer its precise definition is a later time.
You have a type annotation that allow you to declare
that the type you are defining is just an approximation of the type you
would like to define.
Example: You want define a type to define the data structure that can
be json serialize, at this time this is not possible with actual typing system.
So you make the best approximation you do and decorate it with the LooseType annotation.
JsonType = LooseType(Union[List[..,], Dict[...]])
Now you can use this annotation with mypy or other related tool
to keep track of the type that are not precisely defined, and that in
the future you can improve thanks to update of the python typing system.
Metadata
Metadata
Assignees
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations