Textwrap doesn't honour NO-BREAK SPACE

Terry Reedy tjreedy at udel.edu
Fri Sep 29 01:55:35 EDT 2017


On 9/29/2017 1:25 AM, Steve D'Aprano wrote:
> I don't have Python 3.6 installed, can somebody check to see whether or not it
> shows the same (wrong) behaviour?
> 
> 
> import textwrap
> text = ('Lorum ipsum dolor sit amet, consectetur adipiscing'
>          ' elit ZZZ\xa0ZZZ sed do euismod tempor incididunt'
>          ' ut labore et dolore magna aliqua.')
> print(textwrap.fill(text, 59))
> 
> 
> 
> Expected result:
> 
> 
> Lorum ipsum dolor sit amet, consectetur adipiscing elit
> ZZZ ZZZ sed do euismod tempor incididunt ut labore et
> dolore magna aliqua.

On Windows 10, I get this on 2.7, 3.5, 3.6, 3.7.

> Actual result in Python 3.5 and older:
> 
> Lorum ipsum dolor sit amet, consectetur adipiscing elit ZZZ
> ZZZ sed do euismod tempor incididunt ut labore et dolore
> magna aliqua.
> 
> 
> I'm pretty sure this is a bug.


-- 
Terry Jan Reedy




More information about the Python-list mailing list