How would I decide:
First, I would get for each key a list containing tuples, where the first element would be the key, and the second would be one of the values ββfrom the list:
>>> [ [ (k, i) for i in l] for k, l in d.items() ] [[('I1', 1), ('I1', 3), ('I1', 5), ('I1', 2)], [('I0', 0), ('I0', 1), ('I0', 5), ('I0', 2)], [('I2', 5), ('I2', 9), ('I2', 10), ('I2', 1)]]
Then I would cross out this list by creating a list of tuples containing each corresponding key using the zip function:
>>> list(zip(*[ [ (k, i) for i in l] for k, l in d.items() ])) [(('I1', 1), ('I0', 0), ('I2', 5)), (('I1', 3), ('I0', 1), ('I2', 9)), (('I1', 5), ('I0', 5), ('I2', 10)), (('I1', 2), ('I0', 2), ('I2', 1))]
These signatures can be passed as a parameter to the dict constructor:
>>> [dict(lp) for lp in zip(*[ [ (k, i) for i in l] for k, l in d.items() ])] [{'I0': 0, 'I1': 1, 'I2': 5}, {'I0': 1, 'I1': 3, 'I2': 9}, {'I0': 5, 'I1': 5, 'I2': 10}, {'I0': 2, 'I1': 2, 'I2': 1}]
In practice, however, I would never recommend doing such a thing on just one line:
>>> pairs = [ [ (k, i) for i in l] for k, l in d.items() ] >>> transversed = zip(*pairs) >>> ds = [dict(t) for t in transversed] >>> pprint(ds) [{'I0': 0, 'I1': 1, 'I2': 5}, {'I0': 1, 'I1': 3, 'I2': 9}, {'I0': 5, 'I1': 5, 'I2': 10}, {'I0': 2, 'I1': 2, 'I2': 1}]
Actually, I would say that I posted this answer mainly to suggest that you split your solution into more than one line.