Please forgive the stupid question, but given that the JSON standard is 
so obviously broken (being unable to serialise valid values from a 
supported type, what on earth were they thinking???), wouldn't all this 
time and energy be better aimed at fixing the standard rather than 
making Python's JSON encoder broken by default?

On Tue, Jun 16, 2020 at 06:48:19PM +0200, Serge Bazanski wrote:

> What does the list think of the following two ideas:
> 
> 1)  Document this lack of standards compliance better

> 2)  Fix the current behavior of JSON encoding in Python with regards
>     to NaN/Inf/-Inf values

For some value of "fix".

A third option would be for the JSON encoder to emit a warning if it 
actually encodes an INF or NAN.


>     A discussion naturally arises on whether increased standards
>     compliance is wroth the breakage of backwards compatibility, or
>     whether there is a way to implement this change in a less drastic
>     way (transition period with warning? defaulting to converting
>     invalid values to null? something else?).

Because it would break backwards compatibility, there would have to be a 
transition period. At the moment, that is handled on a de facto basis, 
but PEP 387 aims to make it offical and even more strict:

https://www.python.org/dev/peps/pep-0387/

-- 
Steven
_______________________________________________
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/26UFMCUTMJ7F6YYTB4NYH2CRVBJNS6WX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to