Q: Bit permutation with index dictionary I'm looking for the sober pythonic way to swap items in a list according to a "index-dictionary":
input = [[0 1 0 0],[0 1 0 1],[1 1 0 1],[0 0 0 1]]

should lead to:
output = [[0 0 1 0],[1 1 1 0],[0 1 0 0],[0 1 1 1]]

according to the following bit permutation:
pos_old  | 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15   
pos_new  | 00 04 08 12 01 05 09 13 02 06 10 14 03 07 11 15

Example:
The bit on index 04 of input is a 0 and therefore should be interchanged according to pos_new with the bit at index 01 which is a 1.

A: There are several ways to make this happen. One is to use nested list comprehensions (and a bit of index arithmetic):
permutation = [[0, 4, 8, 12], [1, 5, 9, 13], [2, 6, 10, 14], [3, 7, 11, 15]]

def permute(bits):
    return [[bits[i/4][i%4] for i in chunk] for chunk in permutation]

This will build your output chunk by chunk, bit by bit, fetching the correct value according to the index given in the permutation. input[i/4][i%4] does the lookup, where i/4 (in Python 3: i//4 instead, because we need integer division) selects the right input chunk and i%4 selects the right item from that input chunk (% is the modulo operator in python).
Let's see whether it works and not only with bits, too:
>>> permute([[0, 1, 0, 0],[0, 1, 0, 1],[1, 1, 0, 1],[0, 0, 0, 1]])  % your example
[[0, 0, 1, 0], [1, 1, 1, 0], [0, 0, 0, 0], [0, 1, 1, 1]]

>>> permute([[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]])
[[0, 4, 8, 12], [1, 5, 9, 13], [2, 6, 10, 14], [3, 7, 11, 15]]

>>> permute([[0, 2, 4, 6], [8, 10, 12, 14], [16, 18, 20, 22], [24, 26, 28, 30]])
[[0, 8, 16, 24], [2, 10, 18, 26], [4, 12, 20, 28], [6, 14, 22, 30]]

