On Thu, May 7, 2009 at 11:35 AM, Alan Cameron <alan.came...@iname.com> wrote> I am not sure of this is the right place to ask a question about the > tutorial > > http://docs.python.org/3.0/tutorial/datastructures.html#sets > > why is the printed result of > >>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'} >>>> print(basket) > {'orange', 'banana', 'pear', 'apple'} > > in the sequence given?
Because it's *not a sequence* at all, it's a set. Sets are unordered and contain no duplicate items, hence why the output ordering is arbitrary and only the unique subset of original elements is present. Further info: http://docs.python.org/3.0/library/stdtypes.html#set-types-set-frozenset Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list