On Oct 29, 2:09 pm, Andrew <[email protected]> wrote:
> I use this arbitrary range code *often* so I need a general purpose solution.
> I looked up slice() but the help is of no use, I don't even know how I might
> overload it to embed some logic to concatenate ranges of data; nor even if
> it is possible.
Slices are passed in if provided to __getitem__/__setitem__/
__delitem__, so you'd need to override it at the list level:
class RangedSlicer(list):
def __getitem__(self, item):
# map item.start, .stop and .step to your own semantics
Then wrap your lists with your RangedSlicer class as needed.
--
http://mail.python.org/mailman/listinfo/python-list