def _seq_pprinter_factory(start, end, basetype):
def inner(obj, p, cycle):<EOL><INDENT>typ = type(obj)<EOL>if basetype is not None and typ is not basetype and typ.__repr__ != basetype.__repr__:<EOL><INDENT>return p.text(typ.__repr__(obj))<EOL><DEDENT>if cycle:<EOL><INDENT>return p.text(start + '<STR_LIT>' + end)<EOL><DEDENT>step = len(start)<EOL>p.begin_group(step, start)<EOL>for idx, x in enumerate(obj):<EOL><INDENT>if idx:<EOL><INDENT>p.text('<STR_LIT:U+002C>')<EOL>p.breakable()<EOL><DEDENT>p.pretty(x)<EOL><DEDENT>if len(obj) == <NUM_LIT:1> and type(obj) is tuple:<EOL><INDENT>p.text('<STR_LIT:U+002C>')<EOL><DEDENT>p.end_group(step, end)<EOL><DEDENT>return inner<EOL>
Factory that returns a pprint function useful for sequences.  Used by
the default pprint for tuples, dicts, lists, sets and frozensets.