Chris Angelico wrote:

> 2) Should there be a protocol obj.__json__() to return a string
> representation of an object for direct insertion into a JSON file?

> However, this is a much broader topic, and if you want to push for
> that, I would recommend starting a new thread. As Andrew pointed out,
> trying to get bit-for-bit identical JSON representations out of
> different encoders is usually a bad idea.

I am not sure I have ever asked for bit-for-bit identical JSON representation. 
I have always only mentioned `decimal.Decimal` and the lack of proper way to 
encode it (while having the proper way of decoding it), and if you read the 
subject of the OP it is asking for "raw output" (in the encoder, nothing about 
underlying representation) which if I understand your two options basically 
corresponds to the second one and is probably addressed elsewhere far more 
thoroughly.

If my understanding is right, I would be also very much in favor of this 
approach.
_______________________________________________
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/ZX5EUWO7HD6IMT7W5GSH3ACOG2VGFBHF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to