

Fixing Python's String class - pydanny
http://pydanny.com/fixing-pythons-string-class.html

======
oofabz
Getting the length of a string is a bad idea. Usually you do this because you
want to iterate over the string one character at a time. But getting the
character at a particular index is an O(n) operation, so iterating over a
string this way is O(n^2).

This is 2013, strings are Unicode now, and we have to stop thinking of them as
arrays of characters. The most widely used Unicode encodings, UTF-8 and
UTF-16, both have variable-length characters.

~~~
bskap
As of Python 3.3, unicode string indexing in Python is a constant time
operation. <http://www.python.org/dev/peps/pep-0393/>

~~~
dalke
Unicode string indexing has always been constant time. On UCS-2 builds, the
index might have returned the wrong thing, compared to what a UCS-4 build
would have returned.

------
hayksaakian
I understand this was a joke, but what's the real reason python does not have
a "string".length

~~~
bluecalm
There is built-in len function and there should be only one way to do stuff
according to Python philosophy.

------
KenCochrane
Thought this was a day early for April fools until I realized he uses UTC on
his blog.

