(key, new=new)
return sort_rl
Create a rule to sort by a key function

    >>> from sympy.strategies import sort
    >>> from sympy import Basic
    >>> sort_rl = sort(str)
    >>> sort_rl(Basic(3, 1, 2))
    Basic(1, 2, 3)
Create a rule to sort by a key function
Create a rule to sort by a key function
def sort(key, new=new):
    """ Create a rule to sort by a key function

    >>> from sympy.strategies import sort
    >>> from sympy import Basic
    >>> sort_rl = sort(str)
    >>> sort_rl(Basic(3, 1, 2))
    Basic(1, 2, 3)
    """

    def sort_rl(expr):
        return new(expr.__class__, *sorted(expr.args, key=key))
    return sort_rl
def sort ( key , new = new ) : def sort_rl ( expr ) : return new ( expr . __class__ , * sorted ( expr . args , key = key ) ) return sort_rl