If each of the values in your OrderedDict
is a list (as in the example posted), then results.values()
is a list (or iterable, in python3) of lists. In this case, you can iteratively add them to the set:
actual_hosts = set()
for result in results.ResultsReader(job.results()):
for hosts in results.values():
actual_hosts.update(hosts)
If each of the values is a string, the inner loop is not necessary, and you can add results.values()
to the set directly:
actual_hosts = set()
for result in results.ResultsReader(job.results()):
actual_hosts.update(results.values())