mirror of
https://github.com/python/cpython.git
synced 2025-10-18 04:38:07 +00:00
printlist(): Replaced the guts with a call to textwrap. Yay!
This commit is contained in:
parent
8b7f131f8b
commit
ba78bc4a32
1 changed files with 19 additions and 30 deletions
|
@ -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=[]):
|
||||||
|
@ -723,27 +712,27 @@ _expectations = {
|
||||||
""",
|
""",
|
||||||
'atheos':
|
'atheos':
|
||||||
"""
|
"""
|
||||||
test_al
|
test_al
|
||||||
test_cd
|
test_cd
|
||||||
test_cl
|
test_cl
|
||||||
test_curses
|
test_curses
|
||||||
test_dl
|
test_dl
|
||||||
test_email_codecs
|
test_email_codecs
|
||||||
test_gdbm
|
test_gdbm
|
||||||
test_gl
|
test_gl
|
||||||
test_imgfile
|
test_imgfile
|
||||||
test_largefile
|
test_largefile
|
||||||
test_linuxaudiodev
|
test_linuxaudiodev
|
||||||
test_locale
|
test_locale
|
||||||
test_mhlib
|
test_mhlib
|
||||||
test_mmap
|
test_mmap
|
||||||
test_mpz
|
test_mpz
|
||||||
test_nis
|
test_nis
|
||||||
test_poll
|
test_poll
|
||||||
test_popen2
|
test_popen2
|
||||||
test_resource
|
test_resource
|
||||||
test_socket_ssl
|
test_socket_ssl
|
||||||
test_socketserver
|
test_socketserver
|
||||||
test_sunaudiodev
|
test_sunaudiodev
|
||||||
test_unicode_file
|
test_unicode_file
|
||||||
test_winreg
|
test_winreg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue