Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from typing import Union, List, Dict
- def g(x: Union[
- Dict[str, float],
- Dict[str, Union[str, int]],
- ]):
- pass
- g({"a": 1}) #fails
- g({"a": "b"}) #fails
- g({"a": 1.0}) #passes
- def h(x: Dict[str, Union[float, str, int]]):
- pass
- h({"a": 1}) #passes
- h({"a": "b"}) #passes
- h({"a": 1.0}) #passes
Add Comment
Please, Sign In to add comment