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


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

Slices when extending python with C++

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

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


Contents

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

#18073 — Slices when extending python with C++

Fromrozelak@volny.cz
Date2011-12-28 00:02 +0100
SubjectSlices when extending python with C++
Message-ID<mailman.4163.1325026937.27778.python-list@python.org>

[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

[toc] | [standalone]


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


csiph-web