def order(x):
    """
    Determine sort order of char (x)

    :param x: character to test
    :return: order value

    char class   order value
    ----------   -----------
    '~'           -1
    digits        0
    empty         0
    letters       ascii x
    non-letters   ascii x + 256
    """
    return \
        -1 if x == '~' \
            else 0 if x.isdigit() \
            else 0 if not x \
            else ord(x) if x.isalpha() \
            else ord(x) + 256