(f, P, u, K)
return dmp_from_dict(H, u, K)
Return a polynomial in ``K[x_{P(1)},..,x_{P(n)}]``.

    Examples
    ========

    >>> from sympy.polys.domains import ZZ
    >>> from sympy.polys.densebasic import dmp_permute

    >>> f = ZZ.map([[[2], [1, 0]], []])

    >>> dmp_permute(f, [1, 0, 2], 2, ZZ)
    [[[2], []], [[1, 0], []]]
    >>> dmp_permute(f, [1, 2, 0], 2, ZZ)
    [[[1], []], [[2, 0], []]]
Return a polynomial in ``K[x_{P(1)},..,x_{P(n)}]``.
Return a polynomial in K [ x_ { P ( 1 ) } .. x_ { P ( n ) } ] .
def dmp_permute(f, P, u, K):
    """
    Return a polynomial in ``K[x_{P(1)},..,x_{P(n)}]``.

    Examples
    ========

    >>> from sympy.polys.domains import ZZ
    >>> from sympy.polys.densebasic import dmp_permute

    >>> f = ZZ.map([[[2], [1, 0]], []])

    >>> dmp_permute(f, [1, 0, 2], 2, ZZ)
    [[[2], []], [[1, 0], []]]
    >>> dmp_permute(f, [1, 2, 0], 2, ZZ)
    [[[1], []], [[2, 0], []]]

    """
    F, H = dmp_to_dict(f, u), {}

    for exp, coeff in F.items():
        new_exp = [0]*len(exp)

        for e, p in zip(exp, P):
            new_exp[p] = e

        H[tuple(new_exp)] = coeff

    return dmp_from_dict(H, u, K)
def dmp_permute ( f , P , u , K ) : F , H = dmp_to_dict ( f , u ) , { } for exp , coeff in F . items ( ) : new_exp = [ 0 ] * len ( exp ) for e , p in zip ( exp , P ) : new_exp [ p ] = e H [ tuple ( new_exp ) ] = coeff return dmp_from_dict ( H , u , K )