Is it possible to define a class with arbitrary extra keys, or alternatively a Mapping with some required keys? #661
Unanswered
edgarrmondragon
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
-
I'm trying to build a template for Python logging configuration.
The problem:
Each of the values in the
handlers
mapping has a requiredclass
key, a few optional pre-defined keys, and zero or more arbitrary keys which are passed through as keyword arguments to the handler’s constructor defined inclass
.I'm stuck defining the Pkl class for that
So I'm currently forced to use a
Mapping
, which loses a lot of the information compared to the class:So, it is possible to define a class with arbitrary extra keys, or alternatively a Mapping with some required keys?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions