what does is ?
Martin v. Löwis
loewis at informatik.hu-berlin.de
Wed Nov 27 09:06:06 EST 2002
Gerhard Häring <gerhard.haering at opus-gmbh.net> writes:
> But it seems to me that the [:] slicing has an additional
> optimization, apart from interning.
Indeed; this is the code
if (i == 0 && j == a->ob_size && PyString_CheckExact(a)) {
/* It's the same as a */
Py_INCREF(a);
return (PyObject *)a;
}
Notice that this optimization is only valid for immutable sequences;
this specific code is for strings.
Regards,
Martin
More information about the Python-list
mailing list