[Python-Dev] unifying str and unicode

"Martin v. Löwis" martin at v.loewis.de
Mon Oct 3 23:28:46 CEST 2005

Antoine Pitrou wrote:
> To which you apparently didn't read my answer, that is:
> you can never be sure that a variable containing something which
> is /semantically/ textual (*) will never contain anything other than
> ASCII text.

That is simply not true. There are variables that is semantically
textual, yet I can be sure that this is a byte string only if it
consists just of ASCII.

For example, if you invoke a Tkinter function, it will return a byte
string if the result is purely ASCII, else return a Unicode string.
This is an interface guarantee, hence I can be sure.


More information about the Python-Dev mailing list