I need a faster way to generate all permutations of a list, then check if each one is in a dictionary.
for x in range (max_combo_len, 0, -1):
possible_combos = []
permutations = list(itertools.permutations(bag,x))
for item in permutations:
possible_combos.append(" ".join(item))
#then check to see if each possible combo is in a specific Dict
If it helps, the lists are all going to be lists of strings. ['such as', 'this', 'one']
My solution works, but it's very slow. It could be that I need to stop using Python, but I thought I'd run it by you experts first!
Best, Gary