From: Greg Ward Date: Mon, 10 Jun 2002 20:36:07 +0000 (+0000) Subject: Allow the standalone wrap() and fill() functions to take arbitrary X-Git-Tag: v2.3c1~5388 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf02ac6154e30708379308f1a3206671e817165d;p=python Allow the standalone wrap() and fill() functions to take arbitrary keyword args, which are passed directly to the TextWrapper constructor. --- 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)