summaryrefslogtreecommitdiff
path: root/Lib/textwrap.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2002-06-10 20:36:07 +0000
committerGreg Ward <gward@python.net>2002-06-10 20:36:07 +0000
commitfafa34ce9bbbcb343f34681cad42de5259f9d0a3 (patch)
treec7277a9707e40479e62a105eb0811cf65df43390 /Lib/textwrap.py
parent0471cbdbdda0356e58fe88233809aab9c3521f95 (diff)
downloadcpython-fafa34ce9bbbcb343f34681cad42de5259f9d0a3.tar.gz
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 552fef6415..af7a48aec5 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)