summaryrefslogtreecommitdiffstats
path: root/Lib/textwrap.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2002-06-10 20:36:07 (GMT)
committerGreg Ward <gward@python.net>2002-06-10 20:36:07 (GMT)
commitcf02ac6154e30708379308f1a3206671e817165d (patch)
tree5624bf802d4ee25efaad397109379a93ec94d0ba /Lib/textwrap.py
parentd34c959140a4563c644ed4eaca2c489d8f1577b5 (diff)
downloadcpython-cf02ac6154e30708379308f1a3206671e817165d.zip
cpython-cf02ac6154e30708379308f1a3206671e817165d.tar.gz
cpython-cf02ac6154e30708379308f1a3206671e817165d.tar.bz2
Allow the standalone wrap() and fill() functions to take arbitrary
keyword args, which are passed directly to the TextWrapper constructor.
Diffstat (limited to 'Lib/textwrap.py')
-rw-r--r--Lib/textwrap.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/textwrap.py b/Lib/textwrap.py
index 552fef6..af7a48a 100644
--- a/Lib/textwrap.py
+++ b/Lib/textwrap.py
@@ -244,8 +244,10 @@ class TextWrapper:
# Convenience interface
-def wrap(text, width):
- return TextWrapper(width=width).wrap(text)
+def wrap(text, width=70, **kwargs):
+ w = TextWrapper(width=width, **kwargs)
+ return w.wrap(text)
-def fill(text, width, initial_tab="", subsequent_tab=""):
- return TextWrapper(width=width).fill(text, initial_tab, subsequent_tab)
+def fill(text, width=70, initial_tab="", subsequent_tab="", **kwargs):
+ w = TextWrapper(width=width, **kwargs)
+ return w.fill(text, initial_tab, subsequent_tab)