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


Groups > comp.lang.python > #18073

Slices when extending python with C++

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rozelak@volny.cz>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.030
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'modules.': 0.07; 'slices': 0.07; 'subject:when': 0.07; 'python': 0.08; 'array.': 0.09; 'hallo,': 0.09; 'indexes': 0.09; 'subject:python': 0.10; 'c++': 0.12; 'class,': 0.15; 'received:internal': 0.18; '(which': 0.19; 'slice': 0.23; 'problem': 0.29; 'array': 0.30; 'url:cz': 0.30; 'from,': 0.32; 'implement': 0.32; 'to:addr:python-list': 0.34; 'behaving': 0.34; 'thank': 0.35; 'question': 0.36; 'subject:with': 0.36; 'revert': 0.37; 'two': 0.37; 'but': 0.37; 'skip:& 10': 0.38; 'to:addr:python.org': 0.40; '8bit%:8': 0.40; 'content- type:multipart/mixed': 0.60; 'your': 0.61; 'kind': 0.61; 'charset:iso-8859-2': 0.62; 'from:no real name:2**0': 0.63; 'received:89': 0.64; 'accepts': 0.64; 'special': 0.68; 'received:62': 0.70; 'url:php': 0.82; 'url:click': 0.95
MIME-Version 1.0
Subject Slices when extending python with C++
From rozelak@volny.cz
X-Originating-Account rozelak/volny.cz
To python-list@python.org
Date Wed, 28 Dec 2011 00:02:16 +0100 (CET)
X-Mailer Volny.cz Webmail2 2.147
X-Originating-Ip 89.111.119.6
X-Originating-Agent Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2
X-Webmail2-Origin rozelak/volny.cz [89.111.119.6]
X-Priority 3
Content-Type multipart/mixed; boundary="=_784b6b8502c38bca4ca2aa48b47779ff"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4163.1325026937.27778.python-list@python.org> (permalink)
Lines 65
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325026937 news.xs4all.nl 6885 [2001:888:2000:d::a6]:39876
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18073

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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.



-- 
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


Thread

Slices when extending python with C++  rozelak@volny.cz - 2011-12-28 00:02 +0100

csiph-web