[Tutor] Quick question regarding Parsing a Delimited string
kent37 at tds.net
Wed Jul 8 21:37:45 CEST 2009
On Wed, Jul 8, 2009 at 1:22 PM, Rich Lovely<roadierich at 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, i[1:]) for i in lst)
> Then you can access it using the normal dictionary interface.
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
More information about the Tutor