Yummy YAML

Recently I have been using YAML here and there (namely with PyYAML and Spyc). And guess what, I really like it! Compared to XML, which I use for data storage in some applications, working with YAML is far more comfortable in many situations.

XML is hierarchical; YAML can be, too. It allows defining lists and hashes. It also is very readable (which is a main goal), especially when compared with XML. I assume it's also more compact since hash keys have to be provided just once while XML requires a start and end tag for every element that is not closed in itself. So, when hand-writing or refactoring smaller files without XML-savvy tools, YAML is a great ease and less error-prone because no equally named end-tag is required. On the other hand, let's not forget about XML's strengths when it comes to namespaces, processing instructions and a lot more.

Eventually, the intended purpose should make up whether to choose XML or an alternative can be utilized. A great example for YAML's usability seems to be its usage in Ruby on Rails (as I learned from a screencast comparing J2EE to Zope/Plone, TurboGears, Django and Ruby on Rails) that saves you from "XML sit-ups" with fat configuration files. Note that a YAML package already comes with current Ruby distributions.

So, should Python adopt YAML, too? With the pure-Python package PyYAML and LibYAML, its C implementation, there is active development going on. Maybe those lighter web frameworks (TurboGears and Django, not Zope) might have a real use for it in their configuration files, too. I would definitely like to see YAML shipping as part of the Python standard library as well as being used in popular Python projects.