Negative array indicies and slice()
Ian Kelly
ian.g.kelly at gmail.com
Tue Oct 30 17:55:41 EDT 2012
On Tue, Oct 30, 2012 at 8:21 AM, Andrew Robinson
<andrew3 at r3dsolutions.com> wrote:
> D'Apriano mentioned the named values, start, stop, step in a slice() which
> are an API and legacy issue; These three names must also be stored in the
> interpreter someplace. Since slice is defined at the "C" level as a struct,
> have you already found these names in the source code (hard-coded), or are
> they part of a .py file associated with the interface to the "C" code?
You mean the mapping of Python attribute names to C struct members?
That's in sliceobject.c:
static PyMemberDef slice_members[] = {
{"start", T_OBJECT, offsetof(PySliceObject, start), READONLY},
{"stop", T_OBJECT, offsetof(PySliceObject, stop), READONLY},
{"step", T_OBJECT, offsetof(PySliceObject, step), READONLY},
{0}
};
More information about the Python-list
mailing list