Dinesh B Vadhia wrote: > The 10,000 string items are sorted. > > The way the autocomplete works is that when a user enters a char eg. > 'f', the 'f' is sent to the server and returns strings with the char > 'f'.
If it is all strings containing 'f' (not all strings starting with 'f') then the binary search will not work. A database might work better for that. You can get all strings containing some substring x with [ item for item in list if x in item ] Of course that is back to linear search. You mentioned before that you want to also show adjacent items? I don't know how to do that with a database either. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor