Permutations

generate_permutations_as_dicts(points, variables)

Generates dictionaries from permutations of ‘points’ mapped to ‘variables’.

This function is a Python implementation of the C++ generate_permutations_as_dicts. It behaves like Python’s itertools.permutations, where each permutation of points is zipped with variables to form a dictionary.

Parameters:
  • points (list[TypeVar(P)]) – A list of strings to be permuted.

  • variables (list[TypeVar(V)]) – A list of strings to be used as keys. The length of permutations will be equal to len(variables).

Yields:

A dictionary where keys are from ‘variables’ and values are from a permutation of ‘points’.

Return type:

Iterator[dict[TypeVar(V), TypeVar(P)]]