def union():
    i = set(range(10000))
j = set(range(5000, 15000))
return i.union(j)

def update():
    i = set(range(10000))
j = set(range(5000, 15000))
i.update(j)
return i
timeit.Timer(union).timeit(10000)
timeit.Timer(update).timeit(10000)
Quick way to extend a set if we know elements are unique