Say I have a TypedDict in Python like the following:
class Things(TypedDict):
thing: Literal["thing-role"]
another_thing: Literal["another-role"]
How can I extract all the values so that they can be passed as a type for a function parameter? Is get_type_hints my only resort?
This entry was edited (1 month ago)
Simon Métais
in reply to Valentino Gagliardi • • •dragon0
in reply to Valentino Gagliardi • • •Does Unpack do what you want?
peps.python.org/pep-0692/
PEP 692 – Using TypedDict for more precise **kwargs typing | peps.python.org
Python Enhancement Proposals (PEPs)Valentino Gagliardi
in reply to dragon0 • • •dragon0
in reply to Valentino Gagliardi • • •Valentino Gagliardi
in reply to dragon0 • • •