small inconsistency in ElementTree (1.2.6)

Damjan gdamjan at gmail.com
Fri Dec 9 13:19:54 EST 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,
while
text is consisted of characters and that's what unicode strings are
for,
strings-made-of-characters.

It seems to me more logical that an et.text to be a unicode object
always.
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
this
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