<br><br><div class="gmail_quote">On Mon, Jul 8, 2013 at 10:30 PM, Stephen J. Turnbull <span dir="ltr"><<a href="mailto:stephen@xemacs.org" target="_blank">stephen@xemacs.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br></div>
Why is indexing a string and returning a grapheme a common case? I<br>
would think the common case would be indexing or iterating over a<br>
grapheme sequence. At least, if we provided such a type, it would<br>
be.[1]<br></blockquote><div><br></div><div>If you want to do any operation on the clusters other than in iteration order, without indexed access you're going to end up doing list(grapheme_clusters(...)) first to give you indexed access. Maybe that's the right thing to do sometimes but I wouldn't force it on people. The string already provides indexed access but I need to know cluster boundaries.</div>
<div><br></div><div>Note that str.find returns an int, not the found string. What do I do with that index if I can't extract clusters in the middle?</div><div><br></div><div>Imagine you're writing code that works on English words. Would the only api you provide be one that iterates over the words? How would you write the function that finds the word after 'the' in a string?</div>
<div><br></div><div>--- Bruce</div></div>