[Python-Dev] [I18n-sig] Unicode strings: an alternative

Skip Montanaro skip@mojam.com (Skip Montanaro)
Wed, 3 May 2000 15:51:49 -0500 (CDT)


    Tom> Is it possible to add a logical length field too? I presume it is
    Tom> too expensive to recalculate the logical (character) length of a
    Tom> string each time len(s) is called? Doing this is only slightly more
    Tom> time consuming than a normal strlen: ...

Note that currently the len() method doesn't call strlen() at all.  It just
returns the ob_size field.  Presumably, with Just's proposal len() would
simply return ob_size/width.  If you used a variable width encoding, Just's
plan wouldn't work.  (I don't know anything about string encodings - is
UTF-8 variable width?)