pyton sequence - ghdrako/doc_snipets GitHub Wiki

list[start:stop:end]

list[slice(start, stop, step)]
range(start, stop, step)

ranges are iterables, but slices are not

list(range(10))
# output: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list(slice(10))
# ERROR: TypeError: 'slice' object is not iterable