Comment

Peter Bengtsson

Nice try but it doesn't preserve the order of the list.

Parent comment

Michael

What about using a dictionary populated with (s.lower(), s)? Then your normal list is in .values(), and look-up is much faster than going through the whole list over and over. I guess it depends how often you need to look for strings disregarding case. d = {} d[ss(name)] = name if ss(name) in d: print name + " there!"

Replies

Michael

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747 shows how to make an ordered dictionary.