Re: Confusing textwrap parameters, and request for RE help

2020-03-30 Thread Chris Angelico
On Tue, Mar 31, 2020 at 8:20 AM Peter Otten <__pete...@web.de> wrote: > > Chris Angelico wrote: > > but an awkward way to spell it. If you mean to call the original wrap > > method, it would normally be spelled super().wrap(para) instead. > > Probably a workaround because super() cannot do its magi

Re: Confusing textwrap parameters, and request for RE help

2020-03-30 Thread Peter Otten
Chris Angelico wrote: [Steve] >>>def wrap(self, text): >>>split_text = text.split('\n') >>>lines = [line for para in split_text for line in textwrap.TextWrapper.wrap(self, para)] [Dennis] >> That... Looks rather incorrect. >> >> In most all list-comprehension

Re: Confusing textwrap parameters, and request for RE help

2020-03-30 Thread Chris Angelico
On Tue, Mar 31, 2020 at 3:53 AM Dennis Lee Bieber wrote: > > On Sun, 29 Mar 2020 04:21:04 +, Steve Smith > declaimed the following: > > >I am having the same issue. I can either get the text to wrap, which makes > >all the text wrap, or I can get the text to ignore independent '/n' > >chara

Textwrapping with paragraphs, was RE: Confusing textwrap parameters, and request for RE help

2020-03-30 Thread Peter Otten
Steve Smith wrote: > I am having the same issue. I can either get the text to wrap, which makes > all the text wrap, or I can get the text to ignore independent '/n' > characters, so that all the blank space is removed. I'd like to set up my > code, so that only 1 blank space is remaining (I'll se

RE: Confusing textwrap parameters, and request for RE help

2020-03-29 Thread Steve Smith
) #with loop with JUST the standard textwrapper.text method applied to it. with open("Art_of_Rhetoric2.txt", "w") as f: f.writelines(textwrap.wrap(page.text,90)) -Original Message- From: Python-list On Behalf Of Dan Sommers Sent: Friday, March 27, 2020 3:51 PM To: p

Re: Confusing textwrap parameters, and request for RE help

2020-03-27 Thread Dan Sommers
On Fri, 27 Mar 2020 15:46:54 -0600 Michael Torrie wrote: > On 3/27/20 3:28 PM, Dan Stromberg wrote: > > Back when I was a kid, and wordprocessors were exemplified by > > WordStar, I heard about a study the conclusion of which was that > > aligned right edges were harder to read - that it was bet

Re: Confusing textwrap parameters, and request for RE help

2020-03-27 Thread Michael Torrie
On 3/27/20 3:28 PM, Dan Stromberg wrote: > Back when I was a kid, and wordprocessors were exemplified by WordStar, I > heard about a study the conclusion of which was that aligned right edges > were harder to read - that it was better to align on the left and leave the > right ragged. > > But one

Re: Confusing textwrap parameters, and request for RE help

2020-03-27 Thread Dan Stromberg
On Fri, Mar 27, 2020 at 1:23 PM Grant Edwards wrote: > On 2020-03-26, Chris Angelico wrote: > > > You know what's a lot more fun? Perfect block justification, no ragged > > edges, no extra internal spaces. I'm not sure whether it's MORE > > annoying or LESS than using internal spaces, but it's c

Re: Confusing textwrap parameters, and request for RE help

2020-03-27 Thread Chris Angelico
On Sat, Mar 28, 2020 at 7:24 AM Grant Edwards wrote: > > On 2020-03-26, Chris Angelico wrote: > > > You know what's a lot more fun? Perfect block justification, no ragged > > edges, no extra internal spaces. I'm not sure whether it's MORE > > annoying or LESS than using internal spaces, but it's

Re: Confusing textwrap parameters, and request for RE help

2020-03-27 Thread Grant Edwards
On 2020-03-26, Chris Angelico wrote: > You know what's a lot more fun? Perfect block justification, no ragged > edges, no extra internal spaces. I'm not sure whether it's MORE > annoying or LESS than using internal spaces, but it's certainly a lot > more fun to write, since you have to compose on

Re: Confusing textwrap parameters, and request for RE help

2020-03-26 Thread Chris Angelico
On Fri, Mar 27, 2020 at 7:44 AM Grant Edwards wrote: > > On 2020-03-26, Richard Damon wrote: > > >> [...] nobody in their right mind would actually > >> want to generate real output that way. > > > > Back in the day it was FREQUENTLY done, in part to show off, anyone > > could type with a typewri

Re: Confusing textwrap parameters, and request for RE help

2020-03-26 Thread Grant Edwards
On 2020-03-26, Richard Damon wrote: >> [...] nobody in their right mind would actually >> want to generate real output that way. > > Back in the day it was FREQUENTLY done, in part to show off, anyone > could type with a typewriter and get jagged right margins, but with a > computer you could get

Re: Confusing textwrap parameters, and request for RE help

2020-03-26 Thread Richard Damon
On 3/26/20 3:20 PM, Grant Edwards wrote: > On 2020-03-26, Peter J. Holzer wrote: >>> Actually, fixed width fonts are easy to justify, you just add additional >>> space between words through the line. >> Yes. It's easy to do it wrong and impossible to do it right :-) >> >> (BTDT) >> >> The problem

Re: Confusing textwrap parameters, and request for RE help

2020-03-26 Thread Grant Edwards
On 2020-03-26, Peter J. Holzer wrote: >> Actually, fixed width fonts are easy to justify, you just add additional >> space between words through the line. > > Yes. It's easy to do it wrong and impossible to do it right :-) > > (BTDT) > > The problem is that you can only insert an integral number

Re: Confusing textwrap parameters, and request for RE help

2020-03-26 Thread Peter J. Holzer
On 2020-03-25 16:09:24 -0400, Richard Damon wrote: > On 3/25/20 3:52 PM, Peter J. Holzer wrote: > > If anything, I think it was fixed-width fonts which contributed to the > > decline of hyphenation: With a fixed-width font you can't get a proper > > justification anyway, and if your right margin is

Re: Confusing textwrap parameters, and request for RE help

2020-03-25 Thread Vlastimil Brom
22. 3. 2020 v 20:02 Chris Angelico : > > When using textwrap.fill() or friends, setting break_long_words=False > without also setting break_on_hyphens=False has the very strange > behaviour that a long hyphenated word will still be wrapped. I > discovered this as a very surprising result when tryin

Re: Confusing textwrap parameters, and request for RE help

2020-03-25 Thread Chris Angelico
On Thu, Mar 26, 2020 at 6:34 AM Peter J. Holzer wrote: > > On 2020-03-23 06:00:41 +1100, Chris Angelico wrote: > > Second point, and related to the above. The regex that defines break > > points, as found in the source code, is: > > > > wordsep_re = re.compile(r''' > > ( # any whitespace >

Re: Confusing textwrap parameters, and request for RE help

2020-03-25 Thread Richard Damon
On 3/25/20 3:52 PM, Peter J. Holzer wrote: > On 2020-03-25 10:02:50 +1300, DL Neil via Python-list wrote: >> Today it feels like an anachronism because it is comes from the era of >> fixed-width fonts and line-lengths denominated in characters*. The issue is >> that it was designed to re-define 'wh

Re: Confusing textwrap parameters, and request for RE help

2020-03-25 Thread Peter J. Holzer
On 2020-03-25 10:02:50 +1300, DL Neil via Python-list wrote: > Today it feels like an anachronism because it is comes from the era of > fixed-width fonts and line-lengths denominated in characters*. The issue is > that it was designed to re-define 'white space' and to enable the conversion > of tex

Re: Confusing textwrap parameters, and request for RE help

2020-03-25 Thread Peter J. Holzer
On 2020-03-23 06:00:41 +1100, Chris Angelico wrote: > Second point, and related to the above. The regex that defines break > points, as found in the source code, is: > > wordsep_re = re.compile(r''' > ( # any whitespace > %(ws)s+ > | # em-dash between words > (?

Re: Confusing textwrap parameters, and request for RE help

2020-03-25 Thread Chris Angelico
On Wed, Mar 25, 2020 at 8:31 PM DL Neil via Python-list wrote: > 1 what features does the terminal offer when a user 'clicks'? > Is it only applicable to URLs and linked to the web-browser within > "Preferred Applications"? Are you able to 'grab' that click from the > app? eg MOUSEDOWN*. In most

Re: Confusing textwrap parameters, and request for RE help

2020-03-25 Thread DL Neil via Python-list
On 25/03/20 11:57 AM, Chris Angelico wrote: On Wed, Mar 25, 2020 at 9:37 AM DL Neil via Python-list wrote: As you observe, the problem with terminal emulators is the extent of their emulation and the degree of adoption of their 'extended features'! My concern grows because of the need (I assu

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread Chris Angelico
On Wed, Mar 25, 2020 at 9:37 AM DL Neil via Python-list wrote: > > As you observe, the problem with terminal emulators is the extent of > their emulation and the degree of adoption of their 'extended features'! > > My concern grows because of the need (I assume) for the URL to be > 'clickable', no

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread DL Neil via Python-list
On 25/03/20 10:30 AM, Chris Angelico wrote: On Wed, Mar 25, 2020 at 8:04 AM DL Neil via Python-list wrote: On 23/03/20 8:00 AM, Chris Angelico wrote: When using textwrap.fill() or friends, setting break_long_words=False without also setting break_on_hyphens=False has the very strange behaviou

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread Chris Angelico
On Wed, Mar 25, 2020 at 8:04 AM DL Neil via Python-list wrote: > > On 23/03/20 8:00 AM, Chris Angelico wrote: > > When using textwrap.fill() or friends, setting break_long_words=False > > without also setting break_on_hyphens=False has the very strange > > behaviour that a long hyphenated word wil

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread DL Neil via Python-list
On 23/03/20 8:00 AM, Chris Angelico wrote: When using textwrap.fill() or friends, setting break_long_words=False without also setting break_on_hyphens=False has the very strange behaviour that a long hyphenated word will still be wrapped. I discovered this as a very surprising result when trying

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread Dieter Maurer
Karsten Hilbert wrote at 2020-3-24 10:34 +0100: >On Tue, Mar 24, 2020 at 08:20:32PM +1100, Chris Angelico wrote: > ... >> I'm trying to figure out a way to handle URLs, and that's something >> that has its own governing standard, so the meanings of characters >> like hyphens is well defined. > >Agr

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread Karsten Hilbert
On Tue, Mar 24, 2020 at 08:20:32PM +1100, Chris Angelico wrote: > > > Well um... yes. I think we know that hyphens do indicate word-split > > > points. That's not really in question. > > > > I know you don't mean it like that, but it sounds equally > > future-proof like "all text is ASCII". > > Su

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread Chris Angelico
On Tue, Mar 24, 2020 at 8:19 PM Karsten Hilbert wrote: > > On Tue, Mar 24, 2020 at 08:08:31PM +1100, Chris Angelico wrote: > > > Well um... yes. I think we know that hyphens do indicate word-split > > points. That's not really in question. > > I know you don't mean it like that, but it sounds equa

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread Karsten Hilbert
On Tue, Mar 24, 2020 at 08:08:31PM +1100, Chris Angelico wrote: > Well um... yes. I think we know that hyphens do indicate word-split > points. That's not really in question. I know you don't mean it like that, but it sounds equally future-proof like "all text is ASCII". Karsten -- GPG 40BE 5B0

Re: Confusing textwrap parameters, and request for RE help

2020-03-24 Thread Chris Angelico
On Tue, Mar 24, 2020 at 4:36 AM Dieter Maurer wrote: > > Chris Angelico wrote at 2020-3-23 06:00 +1100: > >When using textwrap.fill() or friends, setting break_long_words=False > >without also setting break_on_hyphens=False has the very strange > >behaviour that a long hyphenated word will still b

Re: Confusing textwrap parameters, and request for RE help

2020-03-23 Thread Dieter Maurer
Chris Angelico wrote at 2020-3-23 06:00 +1100: >When using textwrap.fill() or friends, setting break_long_words=False >without also setting break_on_hyphens=False has the very strange >behaviour that a long hyphenated word will still be wrapped. Having worked with `TeX`, I am familiar that hyphens

Confusing textwrap parameters, and request for RE help

2020-03-22 Thread Chris Angelico
When using textwrap.fill() or friends, setting break_long_words=False without also setting break_on_hyphens=False has the very strange behaviour that a long hyphenated word will still be wrapped. I discovered this as a very surprising result when trying to wrap a paragraph that contained a URL, and