But my proposal is not more complex. Implementing support for Decimal requires 
exactly the same steps as implementing the support for custom type.

1) One has to recognize the type in the input data,
2) Get the JSON representation, possibly by using obj.__str__().
3) Check the output that it conforms JSON real number spec.

The only difference is that in one case you need a kw to specify the custom 
type, in the other, you need a Boolean kw to explicitly pull in decimal.Decimal 
(to avoid unconditional import of decimal).

Then, the decoder already allows custom type, in parse_float, so having the 
same option on the output seems to me better.

I admit, I consider my proposal to be as complex as yours, and better fitting, 
to what is already implemented in decoder.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/WNTP4CRAAAG47HRWQ63W5Z4UD2ITNJFG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to