small inconsistency in ElementTree (1.2.6)

Damjan gdamjan at
Fri Dec 9 19:19:54 CET 2005

>> Do I need to check the output of ElementTree everytime, or there's some
>> hidden switch to change this behaviour?
> no.
> ascii strings and unicode strings are perfectly interchangable, with some
> minor exceptions.

It's not only translate, it's decode too... probably other methods and
behaviour differ too.
And the bigger picture, string objects are really only byte sequences,
text is consisted of characters and that's what unicode strings are

It seems to me more logical that an et.text to be a unicode object
It's text, right!

> if you find yourself using translate all the time
> (why?), add an explicit conversion to the translate code.

I'm using translate because I need it :)

I'm currently just wrapping anything from ElementTree in unicode(), but
seems like an ugly step.

> (fwiw, I'd say this is a bug in translate rather than in elementtree)

I wonder what the python devels will say? ;)

More information about the Python-list mailing list