]> granicus.if.org Git - python/commitdiff
Allow the standalone wrap() and fill() functions to take arbitrary
authorGreg Ward <gward@python.net>
Mon, 10 Jun 2002 20:36:07 +0000 (20:36 +0000)
committerGreg Ward <gward@python.net>
Mon, 10 Jun 2002 20:36:07 +0000 (20:36 +0000)
keyword args, which are passed directly to the TextWrapper constructor.

Lib/textwrap.py

index 552fef6415873cc7dfae81b253406e023623a22b..af7a48aec5721c4a1803bb6e56ce33d42c16c791 100644 (file)
@@ -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)