I have two lists of items:
A = 'mno'
B = 'xyz'
I want to generate all permutations without replacement, simulating the replacement of all combinations of elements in B with elements in B without repeating. eg.
>>> do_my_permutation(A, B)
['mno', 'xno', 'mxo', 'mnx', 'xyo', 'mxy', 'xyz', 'zno', 'mzo', 'mnz', ...]
It is straightforward enough for me to write from scratch, but I know about the Python starndard itertools module , which I believe may already implement this. However, it is difficult for me to define a function that implements this exact behavior. Is there a function in this module that I can use for this?
Cerin source
share