Assuming you also can't use s.union(t) , which is equivalent to s | t s | t you can try
>>> from itertools import chain >>> set(chain(s,t)) set([1, 2, 3, 4, 5, 6])
Or if you want to understand
>>> {i for j in (s,t) for i in j} set([1, 2, 3, 4, 5, 6])
arshajii Jul 02 '13 at 15:12 2013-07-02 15:12
source share