-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the spirit of default= parameter, a similar default_key= parameter #156
Comments
it will be great that we could provide customer parser to turn non-string keys into str, like |
Can also be done to allow OrderedDict to remain ordered while usual dict is sorted:
approximately line 585 in encoder.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the spirit of the dump/dumps default= parameter, a similar default_key= could be specified for
def _stringify_key(key):
For example, currently one may conveniently support UTC datetime as a dictionary value by:
but _stringify_key fails when datetime is a dictionary key.
All of the same cautions would apply, of course, but at least someone who thought they knew what they were doing could get hurt their own way.
I hacked it w/
but it doesn't feel righteous somehow.
The text was updated successfully, but these errors were encountered: