On Aug 26, 2019, at 23:43, Serhiy Storchaka <storch...@gmail.com> wrote:
> 
> 27.08.19 06:38, Andrew Barnert via Python-ideas пише:
>>  * JSON (register the stdlib or simplejson or ujson),
> 
> What if the JSON suffix for?

I think you’d mainly want it in combination with percent-, html-, or 
uu-equals-decoding, which makes it a potential stress test of the “multiple 
affixes” or “affixes with modifiers” idea. Which I think is important, because 
I like what the OP came up with for that idea, so I want to push it beyond just 
the “regex with flags” example to see if it breaks.

Maybe URL, which often has the same html and percent encoding issues, would be 
a better example? I personally don’t need to decode URLs that often in Python 
(unlike in, say, ObjC, where there’s a smart URL class that you use in place of 
strings all over the place), but maybe others do?

> JSON is virtually a subset of Python except that that it uses true, false and 
> null instead of True, False and None.

Is it _virtually_ a subset, or literally so, modulo those three values? I don’t 
know off the top of my head. Look at all the trouble caused by Crockford just 
assuming that the syntax he’d defined was a strict subset of JS when actually 
it isn’t quite.

Actually, now that I think of it, I do know. Python has allow_nan on by 
default, so you’d need to also `from math import nan as NaN` and `from math 
import inf as Infinity`. But is that it? I’m not sure.

And of course if you’ve done this:

    jdec = json.JSONDecoder(parse_float=Decimal)
    __register_prefix__(jdec.decode, 'j')

… then even j'1.1' and 1.1 are no longer the same values.

 Not to mention what you get if you registered Pandas’s JSON reader instead of 
the stdlib’s.
_______________________________________________
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/FICNLZX77UVOYS6P7VG2AYFNUVM3FBMX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to