This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients georg.brandl, inkerman, pitrou, roippi, serhiy.storchaka
Date 2014-11-12.10:06:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <7081372.a5YBIvlUoA@raxxla>
In-reply-to <1415785302.9.0.0882994146253.issue22687@psf.upfronthosting.co.za>
Content
> Why not? I guess it depends on English's rules for word splitting, which I
> don't know.

I suppose this is common rule in many languages. And current code supports it (there is a special code in the regex to ensure this rule).

> In any case, this issue is not about improving correctness,
> only performance.

But the patch shouldn't add a regression.

$ ./python -c "import textwrap; print(textwrap.wrap('this-is-a-useful', width=1, break_long_words=False))"

Current code: ['this-', 'is-a-useful']
Patched: ['this-', 'is-', 'a-', 'useful']

Just use lookahead assertion to ensure that the hyphen is followed by at least two letters.

My previous message is about that current code is not always correct so it is acceptable to replace it with not absolutely equivalent code.
History
Date User Action Args
2014-11-12 10:06:55serhiy.storchakasetrecipients: + serhiy.storchaka, georg.brandl, pitrou, roippi, inkerman
2014-11-12 10:06:55serhiy.storchakalinkissue22687 messages
2014-11-12 10:06:55serhiy.storchakacreate