What is the idiomatic way of reusing key/values of TypedDict when total=False and True is needed? #2151
Unanswered
andresdelfino
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I construct a dictionary in several steps, and during that time I only want to guarantee that it doesn't have invalid key names or value types (total=False)).
Once the dictionary is constructed, I want to guarantee that it contains all the keys with the valid value types (total=True).
What is the idiomatic way to reuse the same key name/value type definition? Should I use the functional syntax and make two calls with the same dictionary specifying keys and values? If I understand correctly, inheritance is not an option.
Beta Was this translation helpful? Give feedback.
All reactions