On Tue, Jul 7, 2009 at 9:44 AM, Campbell Barton <[email protected]>wrote:
> You'll need to add a mapping subscript function that checks for a
> PySlice object rather then an index.
>
> if (PySlice_Check(key)) {
> int len= RNA_property_collection_length(&self->ptr,
> self->prop);
> Py_ssize_t start, stop, step, slicelength;
>
> if (PySlice_GetIndicesEx((PySliceObject*)key, len, &start,
> &stop,
> &step, &slicelength) < 0)
> return NULL;
>
> if (slicelength <= 0) {
> return PyList_New(0);
> }
> else if (step == 1) {
> return existing_simple_slice(self, start, stop);
> }
> else {
> PyErr_SetString(PyExc_TypeError, "slice steps not
> supported");
> return NULL;
> }
> }
>
Cool. How would I add this mapping subscript function? Do you have a code
you could point me at that does this?
cheers,