Mercurial > cpython-lru_cache-weakref
diff Doc/library/difflib.rst @ 53033:6bf426e551d5
Update signature style for optional arguments, part 3.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Fri, 10 Apr 2009 09:03:43 +0000 |
| parents | 03b1233bf5fe |
| children | 78fd15e05258 |
line wrap: on
line diff
--- a/Doc/library/difflib.rst Fri Apr 10 08:31:48 2009 +0000 +++ b/Doc/library/difflib.rst Fri Apr 10 09:03:43 2009 +0000 @@ -72,7 +72,7 @@ The constructor for this class is: - .. function:: __init__([tabsize][, wrapcolumn][, linejunk][, charjunk]) + .. method:: __init__(tabsize=8, wrapcolumn=None, linejunk=None, charjunk=IS_CHARACTER_JUNK) Initializes instance of :class:`HtmlDiff`. @@ -88,8 +88,7 @@ The following methods are public: - - .. function:: make_file(fromlines, tolines [, fromdesc][, todesc][, context][, numlines]) + .. method:: make_file(fromlines, tolines, fromdesc='', todesc='', context=False, numlines=5) Compares *fromlines* and *tolines* (lists of strings) and returns a string which is a complete HTML file containing a table showing line by line differences with @@ -108,8 +107,7 @@ the next difference highlight at the top of the browser without any leading context). - - .. function:: make_table(fromlines, tolines [, fromdesc][, todesc][, context][, numlines]) + .. method:: make_table(fromlines, tolines, fromdesc='', todesc='', context=False, numlines=5) Compares *fromlines* and *tolines* (lists of strings) and returns a string which is a complete HTML table showing line by line differences with inter-line and @@ -122,7 +120,7 @@ contains a good example of its use. -.. function:: context_diff(a, b[, fromfile][, tofile][, fromfiledate][, tofiledate][, n][, lineterm]) +.. function:: context_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\\n') Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in context diff format. @@ -167,7 +165,7 @@ See :ref:`difflib-interface` for a more detailed example. -.. function:: get_close_matches(word, possibilities[, n][, cutoff]) +.. function:: get_close_matches(word, possibilities, n=3, cutoff=0.6) Return a list of the best "good enough" matches. *word* is a sequence for which close matches are desired (typically a string), and *possibilities* is a list of @@ -193,7 +191,7 @@ ['except'] -.. function:: ndiff(a, b[, linejunk][, charjunk]) +.. function:: ndiff(a, b, linejunk=None, charjunk=IS_CHARACTER_JUNK) Compare *a* and *b* (lists of strings); return a :class:`Differ`\ -style delta (a :term:`generator` generating the delta lines). @@ -253,7 +251,7 @@ emu -.. function:: unified_diff(a, b[, fromfile][, tofile][, fromfiledate][, tofiledate][, n][, lineterm]) +.. function:: unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\\n') Compare *a* and *b* (lists of strings); return a delta (a :term:`generator` generating the delta lines) in unified diff format. @@ -326,7 +324,7 @@ The :class:`SequenceMatcher` class has this constructor: -.. class:: SequenceMatcher([isjunk[, a[, b]]]) +.. class:: SequenceMatcher(isjunk=None, a='', b='') Optional argument *isjunk* must be ``None`` (the default) or a one-argument function that takes a sequence element and returns true if and only if the @@ -467,7 +465,7 @@ insert a[6:6] () b[5:6] (f) - .. method:: get_grouped_opcodes([n]) + .. method:: get_grouped_opcodes(n=3) Return a :term:`generator` of groups with up to *n* lines of context. @@ -580,7 +578,7 @@ The :class:`Differ` class has this constructor: -.. class:: Differ([linejunk[, charjunk]]) +.. class:: Differ(linejunk=None, charjunk=None) Optional keyword parameters *linejunk* and *charjunk* are for filter functions (or ``None``):
