range(20)[4:16:2] slice(range(20), 4, 16, 2) from itertools import islice, count islice(count(), 4, 16, 2)