[issue43518] textwrap.shorten does not always respect word boundaries
annesylvie
report at bugs.python.org
Tue Mar 16 12:24:25 EDT 2021
New submission from annesylvie <annesylviedeutsch at gmail.com>:
The `shorten` function from the `textwrap` module does not always break strings at the correct location.
`shorten("hello world!", width=7, placeholder="")`
returns
`'hello'`
as expected, but
`shorten("hello world!!!!!!", width=7, placeholder="")`
returns
`'hello w'`
which is incorrect. The error seems to appear when two or more exclamation marks (in this specific example) are added.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43518>
_______________________________________
More information about the Python-bugs-list
mailing list