[Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.28,1.29

akuchling@users.sourceforge.net akuchling@users.sourceforge.net
Wed, 26 Jun 2002 06:23:57 -0700


Update of /cvsroot/python/python/dist/src/Doc/whatsnew
In directory usw-pr-cvs1:/tmp/cvs-serv2552

Modified Files:
	whatsnew23.tex 
Log Message:
Describe textwrap module

Index: whatsnew23.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** whatsnew23.tex	26 Jun 2002 00:03:05 -0000	1.28
--- whatsnew23.tex	26 Jun 2002 13:23:55 -0000	1.29
***************
*** 25,30 ****
  % getopt.gnu_getopt
  %
- % textwrap.py
- %
  % Docstrings now optional (with --without-doc-strings)
  %
--- 25,28 ----
***************
*** 468,471 ****
--- 466,504 ----
  
  \begin{itemize}
+ 
+ \item The \module{textwrap} module contains functions for wrapping
+ strings containing paragraphs of text.  The \function{wrap(\var{text},
+ \var{width})} function takes a string and returns a list containing
+ the text split into lines of no more than the chosen width.  The
+ \function{fill(\var{text}, \var{width})} function returns a single
+ string, reformatted to fit into lines no longer than the chosen width.
+ (As you can guess, \function{fill()} is built on top of
+ \function{wrap()}.  For example:
+ 
+ \begin{verbatim}
+ >>> import textwrap
+ >>> paragraph = "Not a whit, we defy augury: ... more text ..."
+ >>> textwrap.wrap(paragraph, 60)
+ ["Not a whit, we defy augury: there's a special providence in", 
+  "the fall of a sparrow. If it be now, 'tis not to come; if it", 
+  ...]
+ >>> print textwrap.fill(paragraph, 35)
+ Not a whit, we defy augury: there's
+ a special providence in the fall of
+ a sparrow. If it be now, 'tis not
+ to come; if it be not to come, it
+ will be now; if it be not now, yet
+ it will come: the readiness is all.
+ >>> 
+ \end{verbatim}
+ 
+ The module also contains a \class{TextWrapper} class that actually
+ implements the text wrapping strategy.   Both the 
+ \class{TextWrapper} class and the \function{wrap()} and
+ \function{fill()} functions support a number of additional keyword
+ arguments for fine-tuning the formatting; consult the module's
+ documentation for details. 
+ % XXX add a link to the module docs?
+ (Contributed by Greg Ward.)
  
  \item One minor but far-reaching change is that the names of extension