1s = {0, 1, 2}
2s.discard(0)
3print(s)
4{1, 2}
5
6# discard() does not throw an exception if element not found
7s.discard(0)
8
9# remove() will throw
10s.remove(0)
11Traceback (most recent call last):
12 File "<stdin>", line 1, in <module>
13KeyError: 0
1>>> s = set([1])
2>>> print s.pop()
31
4>>> print s
5set([])
6>>> print s.pop()
7KeyError: pop from an empty set
8