On 2009-07-02 08:19:18 +0200, Michal Čihař wrote:
What I don't get is why "print s" from the debugger does it right, while the print in osc fails in my debugging session.
Just played a bit with the source and I have to admit that I do not understand how the string conversion works :-).
These work fine:
print r.__str__() print unicode(r)
But this one does not:
print r
That's due to the implementation of the print function. It implicitly calls str() on the string returned by __str__() which fails in case the string is a unicode object which contains chars which cannot be converted to ascii (in this case 0xfc). It seems that if you directly pass a string or unicode object to the print call no str() method is called. Another question is if the usage of __str__() is correct in this case because we obviously can't ensure that the result can be converted to ascii - so should we use __unicode__() instead of __str__() in this case? Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org