238
239 a = Fault('id foo', callback_a)
240 b = Fault('id bar', callback_b)
241 s = {a, a, b}242 assert len(s) == 2
243 assert 'foo' in [i.value for i in s]
244 assert 'bar' in [i.value for i in s]
A set cannot have two identical values. When a value is repeated in a set literal,
only the last occurrence will remain. Thus duplicate values should be either modified or removed.
If duplicate elements are needed, that is, multiset, use Counter
from collections
module.
my_set = {"one", "two", "one"}
def myfunc(a, b, c):
my_set = {a, b, a, c}
my_set = {"one", "two", "one"}
def myfunc(a, b, c):
my_set = {a, b, c}