I'm looking for an efficient way of achieving this, which I think is a slicing-like operation:
>>> mylist = range(100)
>>>magicslicer(mylist, 10, 20)
[0,1,2,3,4,5,6,7,8,9,30,31,32,33,34,35,36,37,38,39,60,61,62,63......,97,98,99]
the idea is: the slicing gets 10 elements, then skips 20 elements, then gets next 10, then skips next 20, and so on.
I think I should not use loops if possible, for the very reason to use slice is (I guess) to do the "extraction" efficiently in a single operation.
Thanks for reading.
I think that slices cannot do it, unfortunately. I'd solve the problem using list comprehensions
I'd use a loop: