This is a stupid question I asked in the office today: Imagine you have dictionary and you want to build a new dictionary where the keys are the values and the values are the keys.
Gak came with
new_dict = dict(zip(old_dict.values(), old_dict.keys()))
Thinking about it, I came with
new_dict = dict([(old_dict[k], k) for k in old_dict.keys()])
I know that keys will not return a list anymore on Python 3, so I guess my solution is the right one. :)