"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sun, 16 Apr 2006 01:37:44 -0400, Terry Reedy wrote: >> Do you really need the items sorted? I strongly suspect that a set >> would >> work better. Much easier to randomly add, delete, and check membership. > > The OP didn't say anything about having the items sorted.
Which, along with the specification of unique members, is why I questioned the wisdom of using a list which is sorted and does allow duplicates. > I think he's trying to learn how to use Python, as he says, and > specifically learn about lists at this moment. Telling him to use sets > isn't going to help him learn about lists. Learning about how to use any particular type includes learning when to use it and just as importantly, when not to use it. The OP's difficulties seem to me to stem from not using the right type. It would have been a disservice to him for nobody to mention that and steer him in a better direction. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list