2014-01-12 17:07:17 +00: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 05:00:03 +01:00
|
|
|
print(sorted(out))
|
2014-01-12 17:07:17 +00:00
|
|
|
|
|
|
|
s = set(l)
|
|
|
|
print(s.difference_update())
|
2014-04-07 05:00:03 +01:00
|
|
|
print(sorted(s))
|
2014-01-12 17:07:17 +00:00
|
|
|
print(s.difference_update({1}))
|
2014-04-07 05:00:03 +01:00
|
|
|
print(sorted(s))
|
2014-01-12 17:07:17 +00:00
|
|
|
print(s.difference_update({1}, [2]))
|
2014-04-07 05:00:03 +01:00
|
|
|
print(sorted(s))
|