Cost of "unicode(s)" where s is Unicode

JKPeck JKPeck at gmail.com
Sun Jan 6 11:22:15 EST 2008


On Jan 6, 9:06 am, John Nagle <na... at animats.com> wrote:
>    Does
>
>         text = unicode(text)
>
> make a copy of a Unicode string, or is that essentially a
> free operation if the input is already Unicode?
>
>                                 John Nagle

>>> u = u"abc"
>>> uu = unicode(u)
>>> u is uu
True
>>> s = "abc"
>>> ss = unicode(s)
>>> s is ss
False

HTH,
Jon Peck



More information about the Python-list mailing list