Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Closed
Description
There are some situations where a user wants to have more precisely typed**kwds. Current syntax only allows homogeneous**kwds:
deffun(x:int,*,**options:str)->None: ...
However, in situations with many heterogeneous options listing all options in the signature could be verbose and will require rewriting some existing code. There is a vague idea to allowTypedDict for such situations. For example:
classOptions(TypedDict):timeout:intalternative:stron_error:Callable[[int],None]on_timeout:Callable[[],None] ...deffun(x:int,*,**options:Options)->None: ...
Maybe for such cases theTypedDict used should be automatically understood as defined withtotal=False. Also it is worth mentioning that this feature will allow reusing theTypedDicts in modules where several functions have same (or similar) option sets.