def _grammatical_join_filter ( l , arg = None ) : if not arg : arg = " and |, " try : final_join , initial_joins = arg . split ( "|" ) except ValueError : final_join = arg initial_joins = ", " return grammatical_join ( l , initial_joins , final_join )
python join a string list with grammar
: param l : List of strings to join : param arg : A pipe - separated list of final_join ( and ) and initial_join ( ) strings . For example : return : A string that grammatically concatenates the items in the list .
def _grammatical_join_filter(l, arg=None):
    """
    :param l: List of strings to join
    :param arg: A pipe-separated list of final_join (" and ") and
    initial_join (", ") strings. For example
    :return: A string that grammatically concatenates the items in the list.
    """
    if not arg:
        arg = " and |, "
    try:
        final_join, initial_joins = arg.split("|")
    except ValueError:
        final_join = arg
        initial_joins = ", "
    return grammatical_join(l, initial_joins, final_join)