(compound)
return merged_segs
Split a possibly compound format string into segments.

    >>> split_into_formatters('bold_underline_bright_blue_on_red')
    ['bold', 'underline', 'bright_blue', 'on_red']
    >>> split_into_formatters('red_no_italic_shadow_on_bright_cyan')
    ['red', 'no_italic', 'shadow', 'on_bright_cyan']
Split a possibly compound format string into segments.
Split a possibly compound format string into segments .
def split_into_formatters(compound):
    """Split a possibly compound format string into segments.

    >>> split_into_formatters('bold_underline_bright_blue_on_red')
    ['bold', 'underline', 'bright_blue', 'on_red']
    >>> split_into_formatters('red_no_italic_shadow_on_bright_cyan')
    ['red', 'no_italic', 'shadow', 'on_bright_cyan']
    """
    merged_segs = []
    # These occur only as prefixes, so they can always be merged:
    mergeable_prefixes = ['no', 'on', 'bright', 'on_bright']
    for s in compound.split('_'):
        if merged_segs and merged_segs[-1] in mergeable_prefixes:
            merged_segs[-1] += '_' + s
        else:
            merged_segs.append(s)
    return merged_segs
def split_into_formatters ( compound ) : merged_segs = [ ] # These occur only as prefixes, so they can always be merged: mergeable_prefixes = [ 'no' , 'on' , 'bright' , 'on_bright' ] for s in compound . split ( '_' ) : if merged_segs and merged_segs [ - 1 ] in mergeable_prefixes : merged_segs [ - 1 ] += '_' + s else : merged_segs . append ( s ) return merged_segs