A dictionary comprehension is similar to a list comprehension except that it produces a dictionary object instead of a list.
A basic example:
Python 2.x2.7
{x: x * x for x in (1, 2, 3, 4)}
# Out: {1: 1, 2: 4, 3: 9, 4: 16}
which is just another way of writing:
dict((x, x * x) for x in (1, 2...