mirror of
https://github.com/python/cpython.git
synced 2025-10-08 08:01:55 +00:00
Fix a few small typos in the docstrings.
get_close_matches(): Do not use %-interpolation for strings when concatenation is more efficient.
This commit is contained in:
parent
f6a9617ba0
commit
f1da6287fc
1 changed files with 5 additions and 5 deletions
|
@ -104,7 +104,7 @@ __init__(isjunk=None, a='', b='')
|
||||||
Optional arg isjunk is None (the default), or a one-argument function
|
Optional arg isjunk is None (the default), or a one-argument function
|
||||||
that takes a sequence element and returns true iff the element is junk.
|
that takes a sequence element and returns true iff the element is junk.
|
||||||
None is equivalent to passing "lambda x: 0", i.e. no elements are
|
None is equivalent to passing "lambda x: 0", i.e. no elements are
|
||||||
considered to be junk. For examples, pass
|
considered to be junk. For example, pass
|
||||||
lambda x: x in " \\t"
|
lambda x: x in " \\t"
|
||||||
if you're comparing lines as sequences of characters, and don't want to
|
if you're comparing lines as sequences of characters, and don't want to
|
||||||
synch up on blanks or hard tabs.
|
synch up on blanks or hard tabs.
|
||||||
|
@ -289,7 +289,7 @@ class SequenceMatcher:
|
||||||
Optional arg isjunk is None (the default), or a one-argument
|
Optional arg isjunk is None (the default), or a one-argument
|
||||||
function that takes a sequence element and returns true iff the
|
function that takes a sequence element and returns true iff the
|
||||||
element is junk. None is equivalent to passing "lambda x: 0", i.e.
|
element is junk. None is equivalent to passing "lambda x: 0", i.e.
|
||||||
no elements are considered to be junk. For examples, pass
|
no elements are considered to be junk. For example, pass
|
||||||
lambda x: x in " \\t"
|
lambda x: x in " \\t"
|
||||||
if you're comparing lines as sequences of characters, and don't
|
if you're comparing lines as sequences of characters, and don't
|
||||||
want to synch up on blanks or hard tabs.
|
want to synch up on blanks or hard tabs.
|
||||||
|
@ -299,7 +299,7 @@ class SequenceMatcher:
|
||||||
also .set_seqs() and .set_seq1().
|
also .set_seqs() and .set_seq1().
|
||||||
|
|
||||||
Optional arg b is the second of two sequences to be compared. By
|
Optional arg b is the second of two sequences to be compared. By
|
||||||
default, an empty string. The elements of a must be hashable. See
|
default, an empty string. The elements of b must be hashable. See
|
||||||
also .set_seqs() and .set_seq2().
|
also .set_seqs() and .set_seq2().
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -752,9 +752,9 @@ def get_close_matches(word, possibilities, n=3, cutoff=0.6):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not n > 0:
|
if not n > 0:
|
||||||
raise ValueError("n must be > 0: %s" % `n`)
|
raise ValueError("n must be > 0: " + `n`)
|
||||||
if not 0.0 <= cutoff <= 1.0:
|
if not 0.0 <= cutoff <= 1.0:
|
||||||
raise ValueError("cutoff must be in [0.0, 1.0]: %s" % `cutoff`)
|
raise ValueError("cutoff must be in [0.0, 1.0]: " + `cutoff`)
|
||||||
result = []
|
result = []
|
||||||
s = SequenceMatcher()
|
s = SequenceMatcher()
|
||||||
s.set_seq2(word)
|
s.set_seq2(word)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue