Time complexity of string slice
<p>What's the time complexity of slicing a Python string? Given that Python strings are immutable, I can imagine slicing them being either <code>O(1)</code> or <code>O(n)</code> depending upon how slicing is implemented.</p>

<p>I need to write a function that iterates over all suffixes of a (potentially big) string. I could avoid slicing the string by representing a suffix as a tuple of the entire string plus an index to start reading characters from, but that's ugly. If instead I naively write my function like this:</p>

<pre><code>def do_something_on_all_suffixes(big_string):
    for i in range(len(big_string)):
        suffix = big_string[i:]
        some_constant_time_operation(suffix)
</code></pre>

<p>... will its time complexity be <code>O(n)</code> or <code>O(n<sup>2</sup>)</code>, where <code>n</code> is <code>len(big_string)</code>?</p>