mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Allow the standalone wrap() and fill() functions to take arbitrary
keyword args, which are passed directly to the TextWrapper constructor.
This commit is contained in:
parent
d34c959140
commit
cf02ac6154
1 changed files with 6 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue