def alternating(n):
    for perm in variations(list(range(n)), n):
        p = Permutation(perm)
        if p.is_even:
            yield p
Generates the alternating group of order n, An.
dataset/ETHPy150Open sympy/sympy/sympy/combinatorics/generators.py/alternating