mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
Fix the default placeholder in textwrap.shorten() to be " [...]".
For some reason I forgot to do it before committing the patch in issue #18585.
This commit is contained in:
parent
05eafa887b
commit
c593056744
3 changed files with 11 additions and 11 deletions
|
@ -19,7 +19,7 @@ __all__ = ['TextWrapper', 'wrap', 'fill', 'dedent', 'indent']
|
|||
# since 0xa0 is not in range(128).
|
||||
_whitespace = '\t\n\x0b\x0c\r '
|
||||
|
||||
_default_placeholder = ' (...)'
|
||||
_default_placeholder = ' [...]'
|
||||
|
||||
class TextWrapper:
|
||||
"""
|
||||
|
@ -376,7 +376,7 @@ def shorten(text, width, *, placeholder=_default_placeholder, **kwargs):
|
|||
>>> textwrap.shorten("Hello world!", width=12)
|
||||
'Hello world!'
|
||||
>>> textwrap.shorten("Hello world!", width=11)
|
||||
'Hello (...)'
|
||||
'Hello [...]'
|
||||
"""
|
||||
w = TextWrapper(width=width, **kwargs)
|
||||
return w.shorten(text, placeholder=placeholder)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue