Draft PEP on RSON configuration file format

Terry Reedy tjreedy at udel.edu
Tue Mar 2 12:59:00 EST 2010


On 3/2/2010 11:34 AM, Robert Kern wrote:
> On 2010-03-01 22:55 PM, Terry Reedy wrote:
>> On 3/1/2010 7:56 PM, Patrick Maupin wrote:
>>> On Mar 1, 5:57 pm, Erik Max Francis<m... at alcyone.com> wrote:
>>>> Patrick Maupin wrote:
>>>> This not only seriously stretching the meaning of the term "superset"
>>>> (as Python is most definitely not even remotely a superset of JSON),
>>>> but
>>>
>>> Well, you are entitled to that opinion, but seriously, if I take valid
>>> JSON, replace unquoted true with True, unquoted false with False,
>>> replace unquoted null with None, and take the quoted strings and
>>> replace occurrences of \uXXXX with the appropriate unicode, then I do,
>>> in fact, have valid Python. But don't take my word for it -- try it
>>> out!
>>
>> To me this is so strained that I do not see why why you are arguing the
>> point. So what? The resulting Python 'program' will be equivalent, I
>> believe, to 'pass'. Ie, construct objects and then discard them with no
>> computation or output.
>
> Not if you eval() rather than exec().

 >>> eval(1)

creates and objects and discards it, with a net result of 'pass'.
What do you think I am missing.

It's reasonably well-accepted that
> JSON is very close to being a subset of Python's expression syntax with
> just a few modifications.

It is specifically JavaScript Object Notation, which is very similar to 
a subset of Python's object notation (number and string literals and 
list and dict displays (but not set displays), and three named 
constants). Without operators, it barely qualifies, to me, even as 
'expression syntax'.

To me, comparing object notation with programming language is not 
helpful to the OP's purpose. His main claim is that JSON can be usefully 
extended but that YAML is too much, so that perhaps he, with help, can 
find a 'sweet spot' in between.

Terry Jan Reedy







More information about the Python-list mailing list