Any way to express that a dict is expected to have a key(s) but don't care about other keys?
4 Mar
2020
4 Mar
'20
4:12 p.m.
Looking at TypedDict it seems that it does not like the idea of superfluous keys existing in a dict. In my case I have a REST call returning JSON for an error and all I'm guaranteed is to get an "error" key. But there may be extra keys that provide more details about the specific error. Unfortunately I don't know the exhaustive list of keys so I can't use a TypedDict with `totality == False` to try to be complete. I can't think of any way to somehow say "require/expect this one key, but other keys are OK". Am I missing anything that would let me do this?
303
Age (days ago)
1505
Last active (days ago)
35 comments
17 participants
участники (17)
-
Adrian Garcia Badaracco
-
Anton Agestam
-
Brett Cannon
-
Cohen Karnell
-
David Foster
-
Elazar
-
Eric Traut
-
Greg Werbin
-
Guido van Rossum
-
j.scholbach@posteo.de
-
Jelle Zijlstra
-
Justin Black
-
Mehdi2277
-
Shantanu Jain
-
Steven Troxler
-
Tuomas Suutari
-
Tuomas Suutari