On Wed, Jun 17, 2020 at 10:58:38AM +1000, Chris Angelico wrote: > On Wed, Jun 17, 2020 at 10:43 AM Steven D'Aprano <st...@pearwood.info> wrote: > > > > 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? > > > > What do you mean? JSON doesn't have a "float" type with IEEE > semantics. It just has a "Number" type, which is defined syntactically > but not semantically. It doesn't mandate 53-bit precision, for > instance, so you can carry large integers between languages that > support them.
I never mentioned float type or 53 bit precision. In Javascript: js> typeof(NaN) number js> typeof(Infinity) number Odd as it may seem, NANs and INFs are numbers. And the JSON standard isn't capable of encoding them. The JSON standard defines "number" in such a way that even in the language that originated JSON, it can't represent all numbers. -- 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/2NKDXX4MADMTONIEUYDHCGKX4KFF5FB3/ Code of Conduct: http://python.org/psf/codeofconduct/