Erwin Mayer added the comment:

Regarding the issues mentioned in 
https://github.com/simplejson/simplejson/issues/77, they already apply with the 
current implementation anyway (true is serialized as 'true'), so users must 
already be careful.

The JSONEncoder with default parameters could definitely keep rejecting complex 
keys, but an optional 'encode_complex_keys=False' parameter could be added to 
__init__ to provide this functionality. There would be zero performance impact 
as the parameter check would only be done if all else has failed instead of 
raising the TypeError (the same way _skipkeys does).

In that respect, the patch of this issue would need to be amended (and the C 
version would also need to be changed).

I am trying to fork the json core module to achieve this (to not have to wait 
for the next Python release, assuming it gets implemented), if you are familiar 
with the packaging process of core modules into standalone modules, your advice 
would be much appreciated (and could well help others contribute to Python):
http://stackoverflow.com/questions/36498527/how-to-create-a-customized-version-of-a-core-python-module-that-includes-c-code

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18820>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to