Andrew Barnert wrote:
No you can’t. Decimal accepts strings that aren’t valid as JSON numbers, like `.3`,
That's not a problem as long as it doesn't serialise them that way, which it wouldn't: >>> str(Decimal('.3')) '0.3' > or `nan`, The serialiser could raise an exception in that case. BTW, I just checked what it does with floats: >>> json.dumps(float('nan')) 'NaN' So it seems that it currently doesn't care about strict conformance here. -- Greg _______________________________________________ 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/OO34LREKZCZXEQ226CY3CO3ZDTGHXS3N/ Code of Conduct: http://python.org/psf/codeofconduct/