I cant seem to figure out how to write the following into a one line of code, using set comprehension. If its not possible is there a faster way to do what I am trying to do here? Basically just getting all the values of a dictionary into a set. Some values can be an empty set. A simple example is below
d = {1:set(),2:{1,2,3},3:{4}}
t = set()
for k, v in d.items():
if len(v) > 0:
t.update(v)
print(t)
output
{1,2,3,4}