[Python-ideas] PEP 426, YAML in the stdlib and implementation discovery

Guido van Rossum guido at python.org
Fri May 31 20:43:36 CEST 2013


On Fri, May 31, 2013 at 11:35 AM, Brett Cannon <brett at python.org> wrote:
> So yaml is not going to end up in the stdlib. The format is not used
> widely enough to warrant being added nor have to maintain a parser for
> such a complicated format.

Hm. What makes you think it's not being used widely enough? I suppose
JSON is more popular, but it's not like YAML is dying. AFAIK there's a
3rd party yaml parser that we could incorporate with its authors'
permission -- this would save people from a pretty common dependency
(just like we did for JSON).

>> Is there a reason JSON is used other than YAML not being in the stdlib?
>
> It's simpler, it's Python syntax, it's faster to parse.

I would warn strongly against the "JSON is Python syntax" meme. While
you can usually read JSON with Python's eval(), *writing* it with
repr() is a disaster because of JSON's requirement to use double
string quotes. And as we know, eval() is unsafe, so the conclusion is
that one should always use the json module, and never rely on the fact
that it looks like Python (except that it makes the format easy to
understand to humans familiar with Python).

(I have no opinion on the use of YAML for metadata.)

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-ideas mailing list