Skip to content

Combining UserDict and TypedDict #1644

Closed Answered by Daverball
lubo asked this question in Q&A
Feb 29, 2024 · 3 comments · 3 replies
Discussion options

You must be logged in to vote

This is not possible, the only type you can use with a TypedDict is dict or more specifically a dict literal, since otherwise you lose the types of the individual key value pairs, you cannot even use subclasses of dict currently, although PEP 728 may carve out some exceptions for a uniform closed TypedDict. This wouldn't help with your use-case though.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@Daverball
Comment options

@Daverball
Comment options

@Daverball
Comment options

Answer selected by lubo
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants