On 2014-09-04 06:17, Chris Angelico wrote:
On Thu, Sep 4, 2014 at 9:39 AM, MRAB <pyt...@mrabarnett.plus.com> wrote:
I occasionally think about a superset of JSON, called, say, "pyson" ...
ah, name already taken! :-(
While I'm somewhat sympathetic to the concept, there are some parts of
your description that I disagree with. Am I misreading something? Are
there typos in the description and I'm making something out of
nothing?
It would add tuples, delimited by (...), which are not used otherwise (no
expressions):
() => ()
(0, ) => (0)
This seems odd. Part of JSON's convenience is that it's a subset of
JavaScript syntax, so you can just plop a block of JSON into a REPL
and it'll decode correctly. With PyON (or whatever you call it), it'd
be nice to have the same correspondence; for a start, I would strongly
encourage the "trailing comma is permitted" rule (so [1,2,3,] is
equivalent to [1,2,3]), and then I'd have the default encoding for a
single-element tuple include that trailing comma. If (0) is a
one-element tuple, you end up with a subtle difference between a PyON
decode and the Python interpreter, which is likely to cause problems.
It might even be worth actually mandating (not just encouraging) that
one-element tuples have the trailing comma, just to prevent that.
[snip]
JSON has 'true' and 'false'.
Python has 'True' and 'False'.
Therefore, if you want it to be able to drop it into Python's REPL, it
won't be compatible with JSON anyway! (Well, not unless you define
'true' and 'false' first.)
--
https://mail.python.org/mailman/listinfo/python-list