On Wed, 14 Aug 2019 04:21:05 +1000 Chris Angelico <[email protected]> wrote: > > That's one of the reasons that a simple solution of "make JSONEncoder > respect decimal.Decimal" was rejected - it would require that the json > module import decimal, which is extremely costly. Having a __json__ > protocol would be less costly, but would still have a cost, so this > needs to be factored in.
You can take a page from pickle: __reduce__ is not looked up on built-il types such as int, str, tuple, etc. whose serialization is hard-coded. Regards Antoine. _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/W4AQO7HI3W6YSSVTNJAFCLCY7Z5P7QHU/ Code of Conduct: http://python.org/psf/codeofconduct/
