Slices when extending python with C++

R

rozelak

Hallo,
I have kind of special question when extening python with C++
implemented modules.

I try to implement a class, behaving also like an array. And I need
to implement slice-getters. I implemented PySequenceMethods.sq_slice
to get "simple" slices like:

myobj[x:y]

It works perfectly, without problems. But now I have a problem when
need to access the array with "special" slices, like:

myobj[x:y:step]
myobj[::-1] # to revert the array

I would like to ask which method must be implemented to get this
"special" slice getters. The "simple" slice
PySequenceMethods.sq_slice getter accepts only two indexes - from,
to, but not a step (which would solve the issue).

Thank you very much for your ansver, best regards
Dan T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top