On Wednesday, June 10, 2020, at 08:48 -0500, Alex Hall wrote:

On Wed, Jun 10, 2020 at 3:42 PM J. Pic <j...@yourlabs.org> wrote:

I understand, do you think the python standard library should provide a JSONEncoder and JSONDecoder that supports python standard library objects ?

It would be optional to use, but if you use it then any object from the
python standard library will just work.


I think a JSONEncoder for standard types would be nice to have.

Perhaps.

A JSONDecoder is much more complicated. What would it do? Convert every string that looks like an ISO datetime into a Python datetime object? Or convert objects like `{"type": "datetime", "value": "2020-01-01T12:34:56"}`?

IMO, it's worse than that.

If you control both the producers and the consumers, and they're both written in Python, then you may as well use pickle and base64 (and an HMAC!) to convert your python data to an opaque ASCII string and just transmit that string. Why bother with JSON and all of its verbosity and restrictions in the first place?

If interoperability is a concern, then how much does this sort of thing complicate your JSON and all of the other producers/consumers? Will their applications, standard libraries, and best practices "just work"?
_______________________________________________
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/MTHCMJZJCZWF547AYHJOHGBSNQENGTWJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to