Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'slices': 0.07; 'subject:when': 0.07; 'python': 0.08; 'underlying': 0.09; 'subject:python': 0.10; 'c++': 0.12; 'c-api': 0.16; 'enigma': 0.16; 'kern': 0.16; 'py_ssize_t': 0.16; 'pyobject': 0.16; 'robert,': 0.16; 'signature:': 0.16; 'slice.': 0.16; 'to:addr:robert.kern': 0.16; 'looked': 0.16; 'wrote:': 0.18; 'received:internal': 0.18; 'accepting': 0.19; 'to:2**1': 0.21; 'header:In-Reply-To:1': 0.22; '-----': 0.23; 'extending': 0.23; 'slice': 0.23; 'way?': 0.23; 'function': 0.27; 'url:mailman': 0.28; 'interpret': 0.29; 'sorry,': 0.29; 'pm,': 0.29; 'url:cz': 0.30; 'url:listinfo': 0.32; 'implement': 0.32; 'named': 0.33; 'object': 0.33; 'to:addr:python-list': 0.34; 'it.': 0.34; 'thank': 0.35; 'to:no real name:2**1': 0.35; 'url:python': 0.36; 'question': 0.36; 'subject:with': 0.36; 'another': 0.37; 'hold': 0.38; 'url:org': 0.39; 'should': 0.39; 'registered': 0.39; "it's": 0.40; 'to:addr:python.org': 0.40; '8bit%:8': 0.40; 'your': 0.61; 'charset:iso-8859-2': 0.62; 'world': 0.62; 'from:no real name:2**0': 0.63; 'dear': 0.64; 'our': 0.64; 'received:89': 0.64; 'believe': 0.65; 'received:62': 0.70; 'url:php': 0.82; 'subject:++': 0.84; 'eco': 0.91; 'url:click': 0.95 MIME-Version: 1.0 Subject: =?iso-8859-2?Q?Re:_Slices_when_extending_python_with_C=2B=2B?= From: rozelak@volny.cz X-Originating-Account: rozelak/volny.cz To: robert.kern@gmail.com, python-list@python.org Date: Thu, 29 Dec 2011 00:32:27 +0100 (CET) X-Mailer: Volny.cz Webmail2 2.147 X-Originating-Ip: 89.111.119.6 X-Originating-Agent: Mozilla/5.0 (compatible; Konqueror/4.6; Linux) KHTML/4.6.5 (like Gecko) X-Webmail2-Origin: rozelak/volny.cz [89.111.119.6] X-Priority: 3 In-Reply-To: References: <18d00d51ecfd54dcfeb18e1708f6c77d@mail2.volny.cz> Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 62 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325115154 news.xs4all.nl 6970 [2001:888:2000:d::a6]:56190 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18151 Great, it's working! Thank you very much, Robert! Dan T. ----- P=D9VODN=CD ZPR=C1VA ----- Od: "Robert Kern" Komu: python-list@python.org P=F8edm=ECt: 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? > >=20 > Sorry, PyMappingMethods.mp_subscript is the > general function that you need to=20 > implement. >=20 > --=20 > Robert Kern >=20 > "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 >=20 > --=20 > http://mail.python.org/mailman/listinfo/python-list >=20 --=20 Tradi=E8n=ED i modern=ED adventn=ED a novoro=E8n=ED zvyky, sv=E1te=E8n=ED j= =EDdlo a pit=ED, v=FDzdoba a d=E1rky... - =E8t=ECte v=E1no=E8n=ED a silvestrovsk=FD = speci=E1l port=E1lu VOLN=DD.cz na http://web.volny.cz/data/click.php?id=3D1301