[Python-Dev] Re: Where to put wrap_text()?

Tim Peters tim.one@comcast.net
Sat, 01 Jun 2002 19:19:08 -0400

[Greg Ward]
> Damn, I had no idea there was a body of computer science (however small)
> devoted to the art of filling text.

I take it you don't spend much time surveying the range of computer science
literature <wink>.

> Trust Knuth to be there first.  Do you have a reference for this
> algorithm apart from GNU fmt's source code?  Google'ing for "knuth text
> fill algorithm" was unhelpful, ditto with s/fill/wrap/.

Search for

    Knuth hyphenation

instead.  Three months later, the best advice you'll have read is to avoid
hyphenation entirely.  But then you're stuck fighting snaky little rivers of
vertical whitespace without the biggest gun in the arsenal.  Avoid right
justification entirely too, and let the whitespace fall where it may.  Doing
justification with fixed-width fonts is like juggling dirt anyway <wink>.

> Anyways, despite being warned just today on the conceptual/philosophical
> danger of classes whose names end in "-er" [1], I'm leaning towards a
> TextWrapper class, so that everyone may impose their desires through
> subclassing.

LOL!  Resolved, that the world would be a better place if all classes ended
with "-ist".