2014-01-12 12:07:17 -05:00
|
|
|
l = [1, 2, 3, 4]
|
|
|
|
s = set(l)
|
|
|
|
outs = [s.difference(),
|
|
|
|
s.difference({1}),
|
|
|
|
s.difference({1}, [1, 2]),
|
|
|
|
s.difference({1}, {1, 2}, {2, 3})]
|
|
|
|
for out in outs:
|
2014-04-07 00:00:03 -04:00
|
|
|
print(sorted(out))
|
2014-01-12 12:07:17 -05:00
|
|
|
|
|
|
|
s = set(l)
|
|
|
|
print(s.difference_update())
|
2014-04-07 00:00:03 -04:00
|
|
|
print(sorted(s))
|
2014-01-12 12:07:17 -05:00
|
|
|
print(s.difference_update({1}))
|
2014-04-07 00:00:03 -04:00
|
|
|
print(sorted(s))
|
2014-01-12 12:07:17 -05:00
|
|
|
print(s.difference_update({1}, [2]))
|
2014-04-07 00:00:03 -04:00
|
|
|
print(sorted(s))
|