[Patches] [Patch #101664] Add new unistr() builtin + PyObject_Unicode()
C API
Ka-Ping Yee
ping@lfw.org
Wed, 17 Jan 2001 23:51:48 -0800 (PST)
On Wed, 17 Jan 2001 noreply@sourceforge.net wrote:
> Comment:
> This patch adds a utility function unistr() which works just like
> the standard builtin str() -- only that the return value will
> always be a Unicode object.
Sorry for barging in, but i have an issue/question:
Why are unistr() and unicode() two separate functions?
str() performs one task: convert to string. It can convert anything,
including strings or Unicode strings, numbers, instances, etc.
The other type-named functions e.g. int(), long(), float(), list(),
tuple() are similar in intent.
Why have unicode() just for converting strings to Unicode strings,
and unistr() for converting everything else to a Unicode string?
What does unistr(x) do differently from unicode(x) if x is a string?
-- ?!ng