Reputation: 29
I was confused about the structure {item1,item2,item3} in python2.7. Is it a set?
what i did :
while
so,what`s the meaning of {"item1","item2",...} in python2.7 ?
Upvotes: 1
Views: 211
Reputation: 364
You can inspect the type an object with the type()
function and figure what's going on :)
You will discover that in python2.7, a={1, 2, 3}
is a Set. You might be wondering "Hey, but in python2.3 there was a set data structure as well!"
Well, the syntax was slightly different: https://docs.python.org/2/library/sets.html
Therefore, in python2.7, they have added a syntactic sugar for creating sets.
Upvotes: 4