[Python-Dev] textwrap.py

Paul Prescod paul@prescod.net
Fri, 07 Jun 2002 14:59:53 -0700


Greg Ward wrote:
> 
> On 07 June 2002, Tim Peters said:
> > Greg seems to want to do it via setting vrbls on subclasses.  I couldn't
> > care less how it's done, so long as I have some way to wrap for readability
> > in a fixed-width font.
> 
> No subclass required -- just an instance:
> 
>   wrapper = TextWrapper()
>   wrapper.fix_sentence_endings = 0
>   wrapper.wrap(...)
> 
> Not sure if "fix_sentence_endings" is the right spelling, but it'll do
> for now.

Why three statements instead of one expression?

textwrap.wrap_my_text(text, fix_sentence_endings = 0)

If you want to do class-y stuff internally, then go ahead. But wrapping
text is a stateless mathematical function with a domain and range. I'd
prefer function syntax.

 Paul Prescod