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

Rob Williscroft rtw at freenet.co.uk
Sun Jan 6 11:07:34 EST 2008


John Nagle wrote in news:4780fb68$0$36341$742ec2ed at news.sonic.net in 
comp.lang.python:

>    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
> 

http://docs.python.org/lib/built-in-funcs.html#l2h-78

  ... More precisely, if object is a Unicode string or subclass it 
  will return that Unicode string without any additional decoding 
  applied. 
  ...


Rob.
-- 
http://www.victim-prime.dsl.pipex.com/



More information about the Python-list mailing list