textwrap.fill algorithm? (Difference with vim)

Matěj Cepl mcepl at cepl.eu
Sat Apr 22 14:01:51 EDT 2017

On 2017-04-22, 01:01 GMT, Gregory Ewing wrote:
> I don't know what vim is doing, but if you tell Python you
> want lines no longer than 65 characters, it takes you at
> your word.

Oh, I’ve got it. textwrap.fill() (only in Python 2.*?) completely 
sucks with bytes, because of course it counts every byte as 
separate character for purpose of counting. All the text must be 
converted into unicode. It would be probably nice, if the 
textwrap documentation mentioned it.



https://matej.ceplovi.cz/blog/, Jabber: mcepl at ceplovi.cz
GPG Finger: 3C76 A027 CA45 AD70 98B5  BC1D 7920 5802 880B C9D8
Of course I'm respectable. I'm old. Politicians, ugly buildings,
and whores all get respectable if they last long enough.
      --John Huston in "Chinatown."

More information about the Python-list mailing list