grains.utils.index_list

grains.utils.index_list(lst, indices)[source]

Index a list by another list.

Parameters
  • lst (list) – List to be indexed.

  • indices (list) – Indices of the original list that will form the new list.

Returns

list – Members of lst, selected by indices.

Examples

>>> index_list(['c', ['nested', 'list'], 13], [1, 2])
[['nested', 'list'], 13]