Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bpo-37004: Documented asymmetry of string arguments in difflib.SequenceMatcher for ratio method #13482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Doc/library/difflib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,16 @@ The :class:`SequenceMatcher` class has this constructor:
to try :meth:`quick_ratio` or :meth:`real_quick_ratio` first to get an
upper bound.

.. note::

Caution: The result of a :meth:`ratio` call may depend on the order of
the arguments. For instance::

>>> SequenceMatcher(None, 'tide', 'diet').ratio()
0.25
>>> SequenceMatcher(None, 'diet', 'tide').ratio()
0.5


.. method:: quick_ratio()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In the documentation for difflib, a note was added explicitly warning that the results of SequenceMatcher's ratio method may depend on the order of the input strings.