On Wed, Jul 8, 2009 at 1:22 PM, Rich Lovely<roadier...@googlemail.com> wrote:
> If you really want to speed up the search, you could turn the list of lists > into a dict, using the first value in each sublist as a key: > > dct = dict((i[0], i[1:]) for i in lst) > > Then you can access it using the normal dictionary interface. > dct["3991404"][3] I'm suspicious of this claim if there is only one lookup needed. You iterate the whole list and incur the overhead of constructing a dict. If there will be multiple lookups it may well be a win but as always there is no substitute for measurement if you want to know what is faster. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor