[Python C API] Two Different Questions :: PySlice_GetIndices(), copying an object.

Iggeres Bet iggeres at yahoo.es
Fri Dec 6 14:04:15 EST 2002


Hi, 

I have two different questions about the C API on Python 2.2:

-1- Pyslice_GetIndices()

The definition of this function is:

   int PySlice GetIndices(PySliceObject *slice, int length, int
*start, int
   *stop, int *step)

I used it and passed the length of my "list", but the program gave me
an exception because I didn't define the __len__ method in the class.
It's correct? Why PySlice_GetIndices() calls the __len__ method when
we need to pass the length explicitly?


-2- Doing a shallow copy using the C API.

Is it possible to do a shallow copy of my object using the C API
without using the copy module?

The object's class is defined on Python, not in C.


Thank You
Iggeres



More information about the Python-list mailing list