[Doc-SIG] Question about SequenceMatcher.quick_ratio

Brandon Craig Rhodes brandon at rhodesmill.org
Thu May 6 17:00:56 CEST 2010


INADA Naoki <songofacandy at gmail.com> writes:

> I am one of translator of Python document.  But I am not good at
> English well.  I can't understand one sentence ...
>
>> This isn’t defined beyond that it is an upper bound on ratio(), and
>> is faster to compute.

The word "bound" works like this: a "bound" or "boundary" means a limit
or edge, so often it gets used in math like this:

    "I am not sure what the exact value of 'pi' is, but I have done some
     work and established a lower bound of 3.0 and an upper bound of 3.2
     for its true value."

This means, more simply, that 'pi' lies "between 3.0 and 3.2", but math
people have the specific names "lower bound" and "upper bound" for the
limits that they work out for the value of an unknown or difficult-to-
compute number.

So when 'quick_ratio()' claims to return an "upper bound on ratio()", it
means that it returns a number that 'ratio()' is guaranteed to be "less
than"; it sets, in other words, an upper limit on what the actual value
of  'ratio()' might be.

So if 'quick_ratio()' returns 0.8, it means that 'ratio()' itself might
be 0.8, or 0.6, or 0.003, or 0.00062, or even 0; that is, it might be
any permissible ratio value (they run from 0 to 1) that is not more than
0.8 because 'quick_ratio()' has done some checking and is sure that the
actual 'ratio()' is less than or equal to 0.8.

So did my English make the docs any clearer?  Or am I just as confusing? :-)

-- 
Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon


More information about the Doc-SIG mailing list