[Python-checkins] bpo-44544: [doc] list all textwrap func kwargs (GH-26999)

ambv webhook-mailer at python.org
Wed Jul 28 11:15:03 EDT 2021


https://github.com/python/cpython/commit/c1e39d6b1167376fdaf3f288ba9a689e61c7fdd1
commit: c1e39d6b1167376fdaf3f288ba9a689e61c7fdd1
branch: main
author: Jack DeVries <58614260+jdevries3133 at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2021-07-28T17:14:54+02:00
summary:

bpo-44544: [doc] list all textwrap func kwargs (GH-26999)

files:
A Misc/NEWS.d/next/Documentation/2021-07-02-14-02-29.bpo-44544._5_aCz.rst
M Doc/library/textwrap.rst

diff --git a/Doc/library/textwrap.rst b/Doc/library/textwrap.rst
index 16837104b6ceb..b729b836fb615 100644
--- a/Doc/library/textwrap.rst
+++ b/Doc/library/textwrap.rst
@@ -17,7 +17,11 @@ If you're just wrapping or filling one or two text strings, the convenience
 functions should be good enough; otherwise, you should use an instance of
 :class:`TextWrapper` for efficiency.
 
-.. function:: wrap(text, width=70, **kwargs)
+.. function:: wrap(text, width=70, *, initial_indent="", \
+                   subsequent_indent="", expand_tabs=True, \
+                   replace_whitespace=True, fix_sentence_endings=False, \
+                   break_long_words=True, drop_whitespace=True, \
+                   break_on_hyphens=True, tabsize=8, max_lines=None)
 
    Wraps the single paragraph in *text* (a string) so every line is at most
    *width* characters long.  Returns a list of output lines, without final
@@ -30,7 +34,12 @@ functions should be good enough; otherwise, you should use an instance of
    :func:`wrap` behaves.
 
 
-.. function:: fill(text, width=70, **kwargs)
+.. function:: fill(text, width=70, *, initial_indent="", \
+                   subsequent_indent="", expand_tabs=True, \
+                   replace_whitespace=True, fix_sentence_endings=False, \
+                   break_long_words=True, drop_whitespace=True, \
+                   break_on_hyphens=True, tabsize=8, \
+                   max_lines=None)
 
    Wraps the single paragraph in *text*, and returns a single string containing the
    wrapped paragraph.  :func:`fill` is shorthand for  ::
@@ -41,7 +50,9 @@ functions should be good enough; otherwise, you should use an instance of
    :func:`wrap`.
 
 
-.. function:: shorten(text, width, **kwargs)
+.. function:: shorten(text, width, *, fix_sentence_endings=False, \
+                      break_long_words=True, break_on_hyphens=True, \
+                      placeholder=' [...]')
 
    Collapse and truncate the given *text* to fit in the given *width*.
 
@@ -65,7 +76,6 @@ functions should be good enough; otherwise, you should use an instance of
 
    .. versionadded:: 3.4
 
-
 .. function:: dedent(text)
 
    Remove any common leading whitespace from every line in *text*.
diff --git a/Misc/NEWS.d/next/Documentation/2021-07-02-14-02-29.bpo-44544._5_aCz.rst b/Misc/NEWS.d/next/Documentation/2021-07-02-14-02-29.bpo-44544._5_aCz.rst
new file mode 100644
index 0000000000000..4bb69977e0c1a
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2021-07-02-14-02-29.bpo-44544._5_aCz.rst
@@ -0,0 +1,4 @@
+List all kwargs for :func:`textwrap.wrap`, :func:`textwrap.fill`, and
+:func:`textwrap.shorten`. Now, there are nav links to attributes of
+:class:`TextWrap`, which makes navigation much easier while minimizing
+duplication in the documentation.



More information about the Python-checkins mailing list