On Apr 24, 2:32 am, "Hans DushanthaKumar" <hans.dushanthaku...@hcn.com.au> wrote: > Just being pedantic here :) > > [items[x] for x in [i for i in map(values.index, new_values)]] > > Is the same as > > [items[x] for x in map(values.index, new_values)]
It's also the same as [items[x] for x in [values.index(i) for i in new_values]] Which reduces to [items[values.index(i)] for i in new_values] (Although 'i' is not a good choice of variable as it represents a value, not an index) Anyway it doesn't work well if the 'values' list has repeated values, e.g. items = ['spam', 'eggs', 'wafer'] values = [3, 7, 3] -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list