<div class="gmail_quote">On Wed, Aug 31, 2011 at 11:51 AM, Glenn Linderman <span dir="ltr">&lt;<a href="mailto:v%2Bpython@g.nevcal.com">v+python@g.nevcal.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


  
    
  
  <div bgcolor="#FFFFFF" text="#330033"><div><div></div><div class="h5">
    On 8/31/2011 10:12 AM, Guido van Rossum wrote:
    <blockquote type="cite">
      <pre>On Wed, Aug 31, 2011 at 1:09 AM, Glenn Linderman <a href="mailto:v+python@g.nevcal.com" target="_blank">&lt;v+python@g.nevcal.com&gt;</a> wrote:
</pre>
      <blockquote type="cite">
        <pre>So from reading all this discussion, I think this point is rather a key
one... and it has been made repeatedly in different ways:  Arrays are not
suitable for manipulating Unicode character sequences, and the str type is
an array with a veneer of text manipulation operations, which do not, and
cannot, by themselves, efficiently implement Unicode character sequences.
</pre>
      </blockquote>
      <pre>I think this is too strong. The str type is indeed an array, and you
can build useful Unicode manipulation APIs on top of it. Just like
bytes are not UTF-8, but can be used to represent UTF-8 and a
fully-compliant UTF-8 codec can be implemented on top of it.

</pre>
    </blockquote>
    <br></div></div>
    This statement is a logical conclusion of arguments presented in
    this thread.<br>
    <br>
    1) Applications that wish to do grapheme access, wish to do it by
    grapheme array indexing, because that is the efficient way to do it.<br></div></blockquote><div><br>I don&#39;t believe that should be taken as gospel. In Perl, they don&#39;t do array indexing on strings at all, and use regex matching instead. An API that uses some kind of cursor on a string might work fine in Python too (for grapheme matching).<br>

 <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div bgcolor="#FFFFFF" text="#330033">
    2) As long as str is restricted to holding Unicode code units or
    code points, then it cannot support grapheme array indexing
    efficiently.<br>
    <br>
    I  have not declared that useful Unicode manipulations APIs cannot
    be built on top of str, only that efficiency will suffer.<br>
  </div>

</blockquote></div><br>But you have not proven it.<br clear="all"><br>-- <br>--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)<br>