Seems to me you're making life difficult for yourself (and very inefficient) by insisting on doing the whole computation with sets. If you want a set as a result, it's easy enough to construct one from the list at the end.
-- Greg -- https://mail.python.org/mailman/listinfo/python-list