listtools.permutations

abjad.tools.listtools.permutations(l)

Yield all permutations of l.

abjad> l = [1, 2, 3]
abjad> listtools.permutations(l)
<generator object at 0x118c0d0>
abjad> list(_)
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]

Note

This is a stop-gap for Python 2.5 because the 2.6 implementation of itertools includes a built-in permutations function.

Previous topic

listtools.partition_elements_into_canonic_parts

Next topic

listtools.phasor

This Page