socket send O(N**2) complexity
nobody at nowhere.com
Wed Sep 23 01:25:52 CEST 2009
On Mon, 21 Sep 2009 16:33:08 -0400, Jack Diederich wrote:
>> AIUI, as a python string is imutable, a slice of a string is a
>> new string which points (C char *) to the start of the slice data
>> and with a length that is the length of the slice, about 8 bytes
>> on 32 bit machine.
> Not in CPython. While some special strings are re-used (empty string,
> single letters) if you take a slice of an existing string a new buffer
> is allocated and the slice memcpy'd into it.
I can understand doing this for mutable sequences, but it doesn't seem
to make much sense for strings.
More information about the Python-list