1set.update() or |=
2
3>>> a = set('abc')
4>>> l = ['d', 'e']
5>>> a.update(l)
6>>> a
7{'e', 'b', 'c', 'd', 'a'}
8
9>>> l = ['f', 'g']
10>>> a |= set(l)
11>>> a
12{'e', 'b', 'f', 'c', 'd', 'g', 'a'}
1my_set = set([1,2,3,4])
2my_list = list(my_set)
3print my_list
4>> [1, 2, 3, 4]
1names = ['Barry', 'Alice', 'Bob', 'Bob']
2
3unique_names = set(names)
4# Result:
5# {'Alice', 'Barry', 'Bob'}