Assuming you also can't use s.union(t)
, which is equivalent to s | t
, you could try
>>> from itertools import chain
>>> set(chain(s,t))
set([1, 2, 3, 4, 5, 6])
Or, if you want a comprehension,
>>> {i for j in (s,t) for i in j}
set([1, 2, 3, 4, 5, 6])