def gray2int(g, size):
    """ Transforms a Gray code back into an integer. """
    res = 0
    for i in reversed(list(range(size))):
        gi = (g >> i) % 2
        if i == 1 - size:
            bi = gi
        else:
            bi = bi ^ gi
        res += bi * 2 ** i
    return res
dataset/ETHPy150Open pybrain/pybrain/pybrain/utilities.py/gray2int/swapped operands of `-`