To re or not to re ... ( word wrap function?)

Ignacio Vazquez-Abrams ignacio at openservices.net
Fri Sep 21 22:47:32 EDT 2001


On Sat, 22 Sep 2001, Boyd Roberts wrote:

> I think 'scale' was the wrong word.  I should have written 'work'.
>
> >>> t = 'this is some text that will slop'
> >>> n = 'this is the next line in the file'
> >>> print wordwrap(t, 10)
> this is
> some text
> that will
> slop
> >>> print wordwrap(n, 10)
> this is
> the next
> line in
> the file
> >>>
>
> so:
>
>     It is entirely possible to feed the function one line or a subset
>     of lines at a time and it will still perform as expected.
>
> it will work on a subset of cases, but not in the general case.

Notice how I said "one line or a subset of lines", as in terminating properly
with '\n'. At no point did I say that you could feed it a piece of a line
which is what you have done above.

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>





More information about the Python-list mailing list