Convert a list of dictionaries to a dictionary of dictionaries
While using methods with side effects in list- or dict-comprehensions is generally frowned upon, in this case you could make use of dict.pop to get the id and at the same time remove it from the dictionary.

&gt;&gt;&gt; a = [{'bar': 'baz', 'id': 'foo'}, {'bar': 'baz', 'id': 'qux'}]
&gt;&gt;&gt; {d.pop("id"): d for d in a}
{'qux': {'bar': 'baz'}, 'foo': {'bar': 'baz'}}


Keep in mind, though, that this will alter the dictionary in-place, i.e. afterwards:

&gt;&gt;&gt; a
[{'bar': 'baz'}, {'bar': 'baz'}]


If you do not want to alter the original dictionaries, use map(dict, a) to create copies before poping elements from those, leaving the original dicts in a as they were.

&gt;&gt;&gt; {d.pop("id"): d for d in map(dict, a)}
{'qux': {'bar': 'baz'}, 'foo': {'bar': 'baz'}}