Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18151 > unrolled thread

Re: Slices when extending python with C++

Started byrozelak@volny.cz
First post2011-12-29 00:32 +0100
Last post2011-12-29 00:32 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Slices when extending python with C++ rozelak@volny.cz - 2011-12-29 00:32 +0100

#18151 — Re: Slices when extending python with C++

Fromrozelak@volny.cz
Date2011-12-29 00:32 +0100
SubjectRe: Slices when extending python with C++
Message-ID<mailman.4204.1325115154.27778.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web