small inconsistency in ElementTree (1.2.6)
fredrik at pythonware.com
Fri Dec 9 19:43:32 CET 2005
> > ascii strings and unicode strings are perfectly interchangable, with some
> > minor exceptions.
> It's not only translate, it's decode too...
why would you use decode on the strings you get back from ET ?
> probably other methods and behaviour differ too.
> And the bigger picture, string objects are really only byte sequences
not if they contain ASCII characters.
> 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? ;)
well, you're talking to the developer who wrote the original Unicode
More information about the Python-list