27.06.20 10:23, Steven D'Aprano пише:
On Wed, Jun 17, 2020 at 09:18:00AM +0300, Serhiy Storchaka wrote:
Adding NANs and INFs to JSON will break virtually every software which
reads JSON because many (most?) of existing standard-conforming
implementations do not support them.

It won't break anything that doesn't actually include NANs or INFs.

If it does not include NANs or INFs you do need the ability to serialize them.

I don't know anyone who likes the fact that JSON cannot round-trip all
Javascript numbers. Its a source of pain to anyone who deals with such
numbers where infinities and NANs might appear. JSON has changed in the
past, breaking backwards compatibility, and I dare say it will change
again in the future. Why is it unthinkable for this issue?

Javascript numbers are unrelated to Python. Python floats include NaNs and infinities, and it may be a problem if they are occurred in a serialized data. But Python has a non-standard extension (enabled by default for historical reasons) to solve this problem. It is important to understand that it is a non-standard extension, and the result may be not compatible with other JSON implementations.

Maybe future JSON standards will support NaNs and infinities, and other things. But this is not our business. The json module just implements the current standard, and supports compatibility with past implementations.
_______________________________________________
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/DAUEA7MIO6NIEMG2EH446ORL3A54HUDE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to