Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/textwrap.rst

    r2 r391  
    1 
    21:mod:`textwrap` --- Text wrapping and filling
    32=============================================
     
    87.. sectionauthor:: Greg Ward <gward@python.net>
    98
    10 
    119.. versionadded:: 2.3
     10
     11**Source code:** :source:`Lib/textwrap.py`
     12
     13--------------
    1214
    1315The :mod:`textwrap` module provides two convenience functions, :func:`wrap` and
     
    1719otherwise,  you should use an instance of :class:`TextWrapper` for efficiency.
    1820
    19 
    2021.. function:: wrap(text[, width[, ...]])
    2122
     
    2526   Optional keyword arguments correspond to the instance attributes of
    2627   :class:`TextWrapper`, documented below.  *width* defaults to ``70``.
     28
     29   See the :meth:`TextWrapper.wrap` method for additional details on how
     30   :func:`wrap` behaves.
    2731
    2832
     
    112116   .. attribute:: replace_whitespace
    113117
    114       (default: ``True``) If true, each whitespace character (as defined by
    115       ``string.whitespace``) remaining after tab expansion will be replaced by a
    116       single space.
     118      (default: ``True``) If true, after tab expansion but before wrapping,
     119      the :meth:`wrap` method will replace each whitespace character
     120      with a single space.  The whitespace characters replaced are
     121      as follows: tab, newline, vertical tab, formfeed, and carriage
     122      return (``'\t\n\v\f\r'``).
    117123
    118124      .. note::
     
    122128         the same as tab expansion.
    123129
     130      .. note::
     131
     132         If :attr:`replace_whitespace` is false, newlines may appear in the
     133         middle of a line and cause strange output. For this reason, text should
     134         be split into paragraphs (using :meth:`str.splitlines` or similar)
     135         which are wrapped separately.
     136
    124137
    125138   .. attribute:: drop_whitespace
    126139
    127       (default: ``True``) If true, whitespace that, after wrapping, happens to
    128       end up at the beginning or end of a line is dropped (leading whitespace in
    129       the first line is always preserved, though).
     140      (default: ``True``) If true, whitespace at the beginning and ending of
     141      every line (after wrapping but before indenting) is dropped.
     142      Whitespace at the beginning of the paragraph, however, is not dropped
     143      if non-whitespace follows it.  If whitespace being dropped takes up an
     144      entire line, the whole line is dropped.
    130145
    131146      .. versionadded:: 2.6
     
    136151
    137152      (default: ``''``) String that will be prepended to the first line of
    138       wrapped output.  Counts towards the length of the first line.
     153      wrapped output.  Counts towards the length of the first line.  The empty
     154      string is not indented.
    139155
    140156
     
    199215      Wraps the single paragraph in *text* (a string) so every line is at most
    200216      :attr:`width` characters long.  All wrapping options are taken from
    201       instance attributes of the :class:`TextWrapper` instance. Returns a list
    202       of output lines, without final newlines.
     217      instance attributes of the :class:`TextWrapper` instance.  Returns a list
     218      of output lines, without final newlines.  If the wrapped output has no
     219      content, the returned list is empty.
    203220
    204221
Note: See TracChangeset for help on using the changeset viewer.