Python: best way to find out from which set the results of `symmetric_difference` are from? -
what best practice finding out set results of symmetric_difference
from?
intersect = s1.symmetric_difference(s2)
the result should
{'34':'s1', '66':'s2'}
where '34','66' unique items.
to cleanly, following should work:
intersect = s1.symmetric_difference(s2) result = dict([(i, ("s1" if in s1 else "s2")) in intersect])
Comments
Post a Comment