[Python-Dev] UCS2/UCS4 default

Bill Janssen janssen at parc.com
Thu Jul 3 19:43:58 CEST 2008


> Surely it's desirable under all circumstances that
> 
>    len(u) == sum(1 for c in u)
> 
> and that
> 
>    [c for c in u] == [c[i] for i in range(*len(u))]
> 
> How would that play under Jeroen's proposed change?

Yes, but I think the argument is about what "c" is -- a character or a
codepoint.  Your point about efficiency is well-taken; I doubt that
random access to a particular character in a string has to be
efficient -- kind of a dying technique these days -- but slices and
regexp performance need efficiency guarantees.

Bill


More information about the Python-Dev mailing list