def instantiate_factored_mapping(pairs): part_mappings = [[ zip(preimg, perm_img) for perm_img in tools.permutations(img) ] for (preimg, img) in pairs] return tools.cartesian_product(part_mappings)
def instantiate_factored_mapping(pairs): part_mappings = [[list(zip(preimg, perm_img)) for perm_img in itertools.permutations(img)] for (preimg, img) in pairs] return tools.cartesian_product(part_mappings)