title: strcmp for python or how to sort substrings efficiently (without copy) when building a suffix array
body: <p>Here's a very simple way to build an <a href="http://en.wikipedia.org/wiki/Suffix_array" rel="noreferrer">suffix array</a> from a string in python:</p>
  
  <pre><code>def sort_offsets(a, b):
      return cmp(content[a:], content[b:])
  
  content = "foobar baz foo"
  suffix_array.sort(cmp=sort_offsets)
  print suffix_array
  [6, 10, 4, 8, 3, 7, 11, 0, 13, 2, 12, 1, 5, 9]
  </code></pre>
  
  <p>However, "content[a:]" makes a copy of content, which becomes very inefficient when content gets large. So i wonder if there's a way to compare the two substrings without having to copy them. I've tried to use the buffer-builtin, but it didn't worked.</p>