Negative array indicies and slice()
Ian Kelly
ian.g.kelly at gmail.com
Tue Oct 30 01:55:00 EDT 2012
On Mon, Oct 29, 2012 at 12:00 PM, Andrew Robinson
<andrew3 at r3dsolutions.com> wrote:
> I downloaded the source code for python 3.3.0, as the tbz;
> In the directory "Python-3.3.0/Python", look at Python-ast.c, line 2089 &
> ff.
Python-ast.c is part of the compiler code. That's not the struct used
to represent the object at runtime, but the struct used to represent
the AST node while compiling.
For the runtime definition of slices, look at sliceobject.h and
sliceobject.c. Slices are represented as:
typedef struct {
PyObject_HEAD
PyObject *start, *stop, *step; /* not NULL */
} PySliceObject;
"PyObject_HEAD" is a macro that incorporates the object type pointer
and the reference count. Hence, 5 words.
More information about the Python-list
mailing list