[issue3292] Position index limit; s.insert(i,x) not same as s[i:i]=[x]

Raymond Hettinger report at bugs.python.org
Mon Nov 22 00:50:48 CET 2010

Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

Added the i,j,k notes

Left out the processor word size and C-type specifications in-part because it is an implementation detail subject to change.  Another reason is that it doesn't apply to necessarily to all sequences.  Slices take arbitrary objects and with applied to an object's __getitem__, the object itself is responsible for handling it.  Also, the size limits are already reflected in the maximum sizes for the object (a list can't get bigger that Py_ssize_t, so of course, its indicies are similarly bounded).  Adding more text here is leaning towards over-specification of implementation specific details and make the docs harder to read while not adding anything truly helpful.

In particular, it is more harmful than helpful to focus on the edge case where "s.insert(i, x) is not the same as s[i:i] = [x]" when i==sys.maxsize-1.

resolution:  -> fixed
status: open -> closed

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list