Commit ba78bc4a authored by Tim Peters's avatar Tim Peters

printlist(): Replaced the guts with a call to textwrap. Yay!

parent 8b7f131f
...@@ -464,21 +464,10 @@ def printlist(x, width=70, indent=4): ...@@ -464,21 +464,10 @@ def printlist(x, width=70, indent=4):
begin each line. begin each line.
""" """
line = ' ' * indent from textwrap import fill
for one in map(str, x): blanks = ' ' * indent
w = len(line) + len(one) print fill(' '.join(map(str, x)), width,
if line[-1:] == ' ': initial_indent=blanks, subsequent_indent=blanks)
pad = ''
else:
pad = ' '
w += 1
if w > width:
print line
line = ' ' * indent + one
else:
line += pad + one
if len(line) > indent:
print line
class _Set: class _Set:
def __init__(self, seq=[]): def __init__(self, seq=[]):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment