Why don’t you use YAML?
Zed Shaw noticed that he gets flamed when he uses YAML for a python project. I actually don’t understand the hatred the python community has against YAML. Is it because the Ruby guys came up with it?
the fruity and personal webpage of armin ronacher
Zed Shaw noticed that he gets flamed when he uses YAML for a python project. I actually don’t understand the hatred the python community has against YAML. Is it because the Ruby guys came up with it?
Erm, I don’t see anything that Clark Evans (who wrote the initial proposal) has done with Ruby:
Comment by Cary — Thursday, April 10th, 2008 @ 4:15 pmhttp://clarkevans.com/
I’m with you… I think YAML it’s a pretty good format, especially for configuration files.
I’ve built a small configuration library that we use at work and we hope to release it soon, there are still some things to clean out but overall i think YAML kicks ass for configuration files… it’s really readable and useable.
Comment by michele — Thursday, April 10th, 2008 @ 4:51 pmYou don’t understand the hatred because … there is not hatred.
Please stop propagating Zed Shaw’s nonsense. We should all be concerned that he now wants to be part of the Python, because all he sows is hatred, arrogance and sadness.
As your post proves it …
Comment by Longabow — Thursday, April 10th, 2008 @ 5:22 pmI like YAML. I love the idea of it even more and I use it a little bit. I’m surprised given it’s very python-ish use of indentation that Ruby people like and Python people don’t?!
I suppose INI-files gained more traction within the python community and for YAML’s seeming simplicity, the library comes across quiet heavy.
Comment by Kevin Smith — Thursday, April 10th, 2008 @ 5:36 pmUh, what hatred? YAML was written by Python guys too, and intended to mimic Python. A lot of the syntax is Python syntax.
Comment by Cory — Thursday, April 10th, 2008 @ 5:56 pmI actually think it was a Python guy who started it. At least, I vaguely remember the first parser was a Python parser. Then it seemed to languish for some time (like a couple years) until some Ruby people took it up.
I guess YAML is okay, but I always thought it was a bit too clever for its own good.
Comment by Ian Bicking — Thursday, April 10th, 2008 @ 6:02 pmHatred is probably not the best word for it. But it’s certainly not love. And yes, it was not necessarily started by the Ruby community but at least pushed.
@3: Don’t try to take Zed serious.
Regards,
Comment by Armin Ronacher — Thursday, April 10th, 2008 @ 6:05 pmArmin
There is no hate for YAML amongst python developers.
As a mater of fact it was a love of YAML that prompted David Goodger to write docutils and develop ReStructuredText.
We use YAML in python extensively at work.
Zed’s Opinions != Reality
Comment by Doug Napoleone — Thursday, April 10th, 2008 @ 8:42 pmWhen I finally learned about YAML, simplejson had just become available, and it was much lighter/didn’t require c to compile. Also, lack of YAML in standard library is a no go for some. I don’t like adding dependencies if I can avoid it.
I could be completely wrong….
ToddB
Comment by ToddB — Friday, April 11th, 2008 @ 12:18 amFirst off, my blog is about 80% joke so don’t get you’re panties in a bunch Longabow. I’ve already contributed three projects and if the Python community can’t withstand some friendly kidding and questioning of core beliefs from someone trying to understand then it’s already more full of hatred than anything I could possibly bring.
Now, I wouldn’t say people hate YAML so much as love Python way too much. I think every couple of days someone would run into Vellum, see that it had YAML and then propose some braindead Pythonic build format that involved tons of ugly decorators all over the place, complex functions, and they keep missing the point that I’m interested in making the builds safe to load and analyze. Can’t do that with Python because of the stopping problem. In fact, Google had to hack the Python interpreter (probably with Guido’s help) to prevent the average moron from breaking things. Proof right there a safer build format might be needed.
Honestly, Python isn’t the best format for everything no matter how good it is at code. YAML was good, but incredibly complex for the task. Now Vellum has a syntax I wrote because that’s fun (and it’s cleaner).
I think what I did find irritating wasn’t Pythonistas unwillingness to learn YAML, but that they had no objection to it when Google used it. But even my complaints about that were a total huge joke. Like I care that Google uses YAML. People from Planet Python should revel in the fact that they’re sanctified by lord Google.
So, watch for my later releases of Vellum, feel free to send me comments, and thanks for bringing up the question.
Comment by Zed A. Shaw — Friday, April 11th, 2008 @ 1:37 amI wouldn’t use YAML everywhere, but it’s so much less pointlessly verbose for a lot use cases than XML. We (http://www.digsby.com) actually wrote an entire skinning API in YAML!
People are going to love it once it we release documentation for it :)
My only big complaint about YAML is that I that its creators decided that mappings were unordered. So depending on which parser you use to read something like
this:
is: my
awesome:
map: see
The keys might come back in a different order. (We use Python bindings for syck, btw.) There also is some ambiguity about mappings with duplicate keys–syck will give you a list of tuples instead of a dictionary, but I remember other parsers just giving you a mapping with only the “last” key.
IMO ordered mappings with possible duplicate keys (like XML provides) can more naturally describe a greater range of data, which more than makes up for the little bit of extra thinking you have to do with the data once it’s parsed.
Comment by Kevin Watters — Friday, April 11th, 2008 @ 6:08 amI used symfony a lot before (PHP framework) and they use yaml all over the place for configuration. This seems a good idea at first, especially when PHP is the alternative. Then come the trouble: yaml is only suited for totally static description, and you have access to no language tool *at all*, no variable, no formatting, for loop, nothing. This caused innumerable headaches to many users.
Python, compared to PHP, is very terse, and it is perfectly suited for writing configuration files. I don’t see any advantage in using yaml when you can use python (except security?). This is what django does and it brings a flexibility that you cannot dream of with yaml.
I think this is why python programmers don’t often use yaml: python itself is good enough for describing data, and it brings you the enormous power of the language, why limit yourself with yaml?
If for some good reason python wouldn’t be possible for a given configuration file, then I would use yaml, but reluctantly.
Comment by Olivier — Saturday, April 12th, 2008 @ 6:28 am