Antoine Pitrou added the comment:

> I missed this case:
> 
> >>> from textwrap import shorten
> >>> shorten('hell', 4)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
>   "/home/sky/Code/python/programming_language/cpython/Lib/textwrap.py",
>   line 386, in shorten
>     return w.shorten(text, placeholder=placeholder)
>   File
>   "/home/sky/Code/python/programming_language/cpython/Lib/textwrap.py",
>   line 322, in shorten
>     raise ValueError("placeholder too large for max width")
> ValueError: placeholder too large for max width

This is by design. Passing a placeholder larger than the width is a
programming error, regardless of whether the text is small enough.

----------
title: shorten function of textwrap module is susceptible to non-normalized 
whitespaces -> shorten function of textwrap module is susceptible to        
non-normalized whitespaces

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18723>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to