On Wed, Oct 22, 2008 at 3:37 PM, Peter Otten <[EMAIL PROTECTED]> wrote: > Tim Chase wrote: > >> Though for each test, in 2.3, 2.4, and 2.5 that I've got >> installed on my local machine, they each printed "s" in-order, >> and the iteration occurred in-order as well, even without the >> added "sorted(list(s))" code. > > You need more tests then ;) > >>>> list(set([1,1000])) > [1000, 1]
It seems to me that it orders elements when you add using the add() method, but if you create a set starting from a list, it may result unordered. Anyway, the add() fails to order if you try to add a float in a set of integers. > By the way, sorted(s) is sufficient; sorted() accepts arbitrary iterables. I'll try with this. -- http://mail.python.org/mailman/listinfo/python-list