Nick Bastin

Nick Bastin header image 4

Entries from April 2009

Things I hate…

April 28th, 2009 · No Comments

Ok, I could write an entire book about things I hate. Maybe even several volumes. But today, I bring you one special nugget of hatred: blogs whose feeds do not contain the entire contents of their entries. I have banned these blogs from my reading list, even though I might otherwise want [...]

[Read more →]

Tags: Rants

ElementTree is a steaming Unicode pile

April 27th, 2009 · No Comments

So it turns out that ElementTree’s support for unicode is….disturbing.  I can’t say that it’s lacking – it indeed seems to parse properly encoded XML just fine.  The problem is the unexpected way in which the API functions:
dom = ET.XML(‘<?xml version=”1.0″ encoding=”UTF-8″?><foo attr=”funä”>’)
element = dom.find(“foo”)
print type(element.attrib["attr"])
=> unicode
I think this would not be a surprise to [...]

[Read more →]

Tags: Python · Software