Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18151
| Subject | Re: Slices when extending python with C++ |
|---|---|
| From | rozelak@volny.cz |
| Date | 2011-12-29 00:32 +0100 |
| References | <18d00d51ecfd54dcfeb18e1708f6c77d@mail2.volny.cz> <jdf4vc$mr9$1@dough.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4204.1325115154.27778.python-list@python.org> (permalink) |
Great, it's working! Thank you very much, Robert! Dan T. ----- PŮVODNÍ ZPRÁVA ----- Od: "Robert Kern" <robert.kern@gmail.com> Komu: python-list@python.org Předmět: Re: Slices when extending python with C++ Datum: 28.12.2011 - 14:18:36 > On 12/28/11 1:01 PM, rozelak@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 > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Tradiční i moderní adventní a novoroční zvyky, sváteční jídlo a pití, výzdoba a dárky... - čtěte vánoční a silvestrovský speciál portálu VOLNÝ.cz na http://web.volny.cz/data/click.php?id=1301
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Slices when extending python with C++ rozelak@volny.cz - 2011-12-29 00:32 +0100
csiph-web