If I want to make a list of four items, e.g. L = ['C', 'A', 'D', 'B'], and then figure out if a certain element precedes another element, what would be the best way to do that?
Looking at the built-in list functions, I thought I could do something like: if L.index('A') < L.index('D'): # do some stuff But I didn't know if maybe there was a preferred method for this type of operation, or perhaps a better function to use to figure out the ordering. Or even if I wanted to write my own utility function to make it look cleaner than above, I'd still need to use something like above in my function, so I wanted to know what might be the 'cleanest' looking solution. Thanks. -- http://mail.python.org/mailman/listinfo/python-list