In Python I have a list of elements aList and a list of indices myIndices. Is there any way I can retrieve all at once those items in aList>
aList
myIndices
aList>
You could use map
map
map(aList.__getitem__, myIndices)
or operator.itemgetter
operator.itemgetter
f = operator.itemgetter(*aList) f(myIndices)