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.

Er, why?

I can understand doing this for mutable sequences, but it doesn't seem
to make much sense for strings.


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to