Combining Multiple Sets Python

You can do set.union(*tup)

(Tup can also be a generator)

This will unpack to

set.union(tup[0], tup[1], ... tup[n - 1])

Saw this in the context of the Recursive String Permutations 202006231535 problem.


uid: 202006231603 tags: #python


Date
February 22, 2023