[issue12657] Cannot override JSON encoding of basic type subclasses

Éric Araujo report at bugs.python.org
Thu Nov 15 13:24:29 EST 2018


Éric Araujo <merwok at netwok.org> added the comment:

A modern solution for this is to define a singledispatch function (with implementations for your custom types) and pass it as the `default` parameter to the dump functions.

(That won’t avoid the custom → dict copy, but that’s how the module works)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue12657>
_______________________________________


More information about the Python-bugs-list mailing list