@extension(['<STR_LIT:list>', '<STR_LIT:l>', '<STR_LIT>'])<EOL>def list_(formatter, value, name, option, format):
if not format:<EOL><INDENT>return<EOL><DEDENT>if not hasattr(value, '<STR_LIT>') or isinstance(value, string_types):<EOL><INDENT>return<EOL><DEDENT>words = format.split(u'<STR_LIT:|>', <NUM_LIT:4>)<EOL>num_words = len(words)<EOL>if num_words < <NUM_LIT:2>:<EOL><INDENT>return<EOL><DEDENT>num_items = len(value)<EOL>item_format = words[<NUM_LIT:0>]<EOL>spacer = u'<STR_LIT>' if num_words < <NUM_LIT:2> else words[<NUM_LIT:1>]<EOL>final_spacer = spacer if num_words < <NUM_LIT:3> else words[<NUM_LIT:2>]<EOL>two_spacer = final_spacer if num_words < <NUM_LIT:4> else words[<NUM_LIT:3>]<EOL>buf = io.StringIO()<EOL>for x, item in enumerate(value):<EOL><INDENT>if x == <NUM_LIT:0>:<EOL><INDENT>pass<EOL><DEDENT>elif x < num_items - <NUM_LIT:1>:<EOL><INDENT>buf.write(spacer)<EOL><DEDENT>elif x == <NUM_LIT:1>:<EOL><INDENT>buf.write(two_spacer)<EOL><DEDENT>else:<EOL><INDENT>buf.write(final_spacer)<EOL><DEDENT>buf.write(formatter.format(item_format, item, index=x))<EOL><DEDENT>return buf.getvalue()<EOL>
Repeats the items of an array.

    Spec: `{:[l[ist]:]item|spacer[|final_spacer[|two_spacer]]}`

    Example::

       >>> fruits = [u'apple', u'banana', u'coconut']
       >>> smart.format(u'{fruits:list:{}|, |, and | and }', fruits=fruits)
       u'apple, banana, and coconut'
       >>> smart.format(u'{fruits:list:{}|, |, and | and }', fruits=fruits[:2])
       u'apple and banana'