In Python, say we have
L = ['a','b','c','d','e','f','g']
and I want to store the elements at indices 1,3,5,6 in another list. In a program like GAP, this is a one-liner:
>>> New_L = L{[1,3,5,6]};
['b', 'd', 'f', 'g']
I've always wondered: is there something like this in Python? Or is this only done roughly as follows:
New_L = []
for i in [1,3,5,6]:
New_L.append(L[i])