Valentino Gagliardi on Nostr: Say I have a TypedDict in Python like the following: class Things(TypedDict): thing: ...
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?
Published at
2025-03-15 16:36:02Event JSON
{
"id": "8129079bf5e28f8f16db659c85d64a988c5cafd1bd98be0244cf31cebc2639dc",
"pubkey": "0b7a9c1152d08f8f19b0b2645d9e830f85997f1881f0e460d5992a4f82e8fcaa",
"created_at": 1742056562,
"kind": 1,
"tags": [
[
"proxy",
"https://fosstodon.org/users/gagliardi_vale/statuses/114167418906379199",
"activitypub"
]
],
"content": "Say I have a TypedDict in Python like the following:\n\nclass Things(TypedDict):\n thing: Literal[\"thing-role\"]\n another_thing: Literal[\"another-role\"]\n\nHow 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?",
"sig": "11b29ebf18bbfe260da4d1da35da94fcbe32716cf8937692ef28530c130af28ccd2d36e25f54ef9ed82b21fe491326be2a662e00e37d4516944644215cb2a190"
}