This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alucab
Recipients Haoyu SUN, alucab, arjanstaring, eric.smith, mark.dickinson, rhettinger
Date 2020-12-29.12:16:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609244172.16.0.649486782406.issue40633@roundup.psfhosted.org>
In-reply-to
Content
I agree with arjanstaring

This implementation is not standard compliant and breaks interoperability with every ECMA compliant Javascript deserializer.

Technically is awful of course but interoperability and standardization come before than technical cleanliness IMHO

Regarding standardization:

If you consider https://tools.ietf.org/html/rfc7159

there is no way to represent the literal "nan" with the grammar supplied in section 6 hence the Infinity and Nan values are forbidden so as "nan"

For interoperability 

If you consider http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf

It is clearly stated in section 24.5.2 Note 4 that JSON.stringify produces null for Infinity and NaN

"Finite numbers are stringified as if by calling ToString(number). NaN and Infinity regardless of sign are represented as the String null"

It is clearly stated in section 24.5.1 that JSON.parse uses eval-like parsing as a reference for decoding. nan is not an allowed keyword at all. For interoperability NaN could be used but out from the JSON standard.

So what happens is that this will break all the ECMA compliant parsers (aka browsers) in the world. Which is what is happening to my project by the way

Pandas serialization methos (to_json) already adjusts this issue, but I really think the standard should too
History
Date User Action Args
2020-12-29 12:16:12alucabsetrecipients: + alucab, rhettinger, mark.dickinson, eric.smith, Haoyu SUN, arjanstaring
2020-12-29 12:16:12alucabsetmessageid: <1609244172.16.0.649486782406.issue40633@roundup.psfhosted.org>
2020-12-29 12:16:12alucablinkissue40633 messages
2020-12-29 12:16:11alucabcreate