YAXL 0.0.3 Released: mixed feelings

by Jeremy Jones

Related link: http://cheeseshop.python.org/pypi/yaxl/0.0.3



I downloaded and played for a few minutes with yaxl, which stands for Yet Another (Pythonic) XML Library. It's interesting and has some potential, but I'm not sure how well it will "compete" (I hate using that word in relation to open source projects, but I can't come up with a more appropriate one just now) with a project such a ElementTree. (By the way, ElementTree is pretty much "the gold standard" in my book.)

One thing I found interesting in yaxl is being able to access an element's attributes via dictionary syntax. If I have <foo a="1" b="2"/>, I can get the values for "a" and "b" by doing foo_element['a'] and foo_element['b']. I like it, sort of, but I'm not too sure how much better that is than ElementTree's foo_element.attrib['a'] and foo_element.attrib['b']. So it saves 7 keystrokes. I'm wavering between +0 and -0 on that. It's cool, kind of Pythonic, clearly expresses the intent of getting attribute data, but I don't think it has an advantage over ElementTree's syntax, which shares some of the same benefits.

One thing that I didn't like is that "anyelement.children" is a list of all of its descendants rather than just its immediate children. I like the isolation of accessing just the immediate children rather than the children plus their children plus their children.... Maybe there's another way of getting just the immediate children without having to resort to a list comprehension to do it, which doesn't appear to work since "anyelement.parent" seems to only return None.

This is an interesting library and, based on the dates on the Cheese Shop, is very new, so I'm certain it has some inevitable changes it will go through. I wish it well. I'm interested to see how it is received by the Python community and what niche it may fill.

1 Comments

effbot
2005-12-08 01:34:39
attribute access
foo_element.attrib['a']


footnote: the preferred syntax is foo_element.get('a')


this works like foo_element.attrib.get('a'), but may use a more efficient internal implementation.