[issue26214] textwrap should minimize number of breaks in extra long words

2021-12-27 Thread Andrei Kulakov
Andrei Kulakov added the comment: It may be worth fixing wrap() to do the nicer style of wrapping for long words. If we decide to do that, it should be done via a new parameter because the same logic (TextWrapper class) is used for `shorten` and in that case it may be preferable to have the

[issue26214] textwrap should minimize number of breaks in extra long words

2020-09-19 Thread Georg Brandl
Change by Georg Brandl : -- nosy: -georg.brandl ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26214] textwrap should minimize number of breaks in extra long words

2020-09-19 Thread Irit Katriel
Change by Irit Katriel : -- components: +Library (Lib) ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26214] textwrap should minimize number of breaks in extra long words

2020-09-04 Thread Irit Katriel
Irit Katriel added the comment: To clarify, this solution is a linear-time greedy one, with three passes: - the first pass puts each long word on its own line. - the second pass chops them up into words of at most width characters. - the third pass wraps them, when there are no more long

[issue26214] textwrap should minimize number of breaks in extra long words

2020-09-04 Thread Irit Katriel
Irit Katriel added the comment: One more wrap: >>> wr(' '.join(itertools.chain(*(wr(x, 5) for x in wr("123 123 1234567 12", >>> width=5, break_long_words=False, 5) ['123', '123', '12345', '67 12'] -- ___ Python tracker

[issue26214] textwrap should minimize number of breaks in extra long words

2020-09-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The code with nested wraps is awesome. But it does not work well. >>> list(itertools.chain(*(wr(x, 5) for x in wr("123 123 1234567 12", width=5, >>> break_long_words=False ['123', '123', '12345', '67', '12'] It is expected that '67' and '12' should be

[issue26214] textwrap should minimize number of breaks in extra long words

2020-09-04 Thread Irit Katriel
Irit Katriel added the comment: You can do this already with the break_long_words arg of testwrap: >>> import itertools, textwrap >>> wr = textwrap.wrap >>> list(itertools.chain(*(wr(x, 5) for x in wr("123 123 1234567", width=5, >>> break_long_words=False ['123', '123', '12345', '67']

[issue26214] textwrap should minimize number of breaks in extra long words

2018-09-21 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26214] textwrap should minimize number of breaks in extra long words

2016-02-11 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker ___ ___

[issue26214] textwrap should minimize number of breaks in extra long words

2016-01-29 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- type: behavior -> enhancement versions: -Python 2.7 ___ Python tracker ___

[issue26214] textwrap should minimize number of breaks in extra long words

2016-01-27 Thread Tuomas Salo
Changes by Tuomas Salo : -- title: textwrap should minimize breaks -> textwrap should minimize number of breaks in extra long words ___ Python tracker

[issue26214] textwrap should minimize number of breaks in extra long words

2016-01-27 Thread SilentGhost
Changes by SilentGhost : -- nosy: +georg.brandl versions: +Python 3.6 -Python 3.4 ___ Python tracker ___