Slices when extending python with C++
Robert Kern
robert.kern at gmail.com
Wed Dec 28 08:18:36 EST 2011
More information about the Python-list mailing list
Wed Dec 28 08:18:36 EST 2011
- Previous message (by thread): Re: Slices when extending python with C++
- Next message (by thread): Re: Slices when extending python with C++
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12/28/11 1:01 PM, rozelak at volny.cz wrote: > Dear Robert, > > thank you very much for your answer. I understand what you mean and > I have looked at slice object and C-api methods it provides. It > should be easy to implement it. > > The only question is how exactly yo implement the general getter, > since sq_item you mention (assume you mean > PySequenceMethods.sq_item) has the following signature: > > PyObject * (* ssizeargfunc)(PyObject *, Py_ssize_t) > > accepting Py_ssize_t as the index, not a PyObject * which would hold > the slice. > > So, how exactly to implement the getter? As a general method named > __getitem__ registered in PyMethodDef? Or in another way? Sorry, PyMappingMethods.mp_subscript is the general function that you need to implement. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
- Previous message (by thread): Re: Slices when extending python with C++
- Next message (by thread): Re: Slices when extending python with C++
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list