unordered set in python...question about how the items within it are displayed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kantor3
    New Member
    • Jun 2012
    • 1

    unordered set in python...question about how the items within it are displayed

    since sets in python are unordered collection,a set does't show the items it contains in the same order they have added. is it however safe to assume that the items will be displayed always in the same order?? eg.
    i create the following set
    test = set['regina', 'paul', 12, 'cool' ]

    if i want to show the items in test
    test
    i may get the following output: set(['cool', 12, 'paul', 'regina'])
    does it mean the items will be showed from now on in that same order?
    thanks folks
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Probably in the short term, but there is no guarantee the order will be the same in other versions of Python.

    Comment

    Working...