title: How does Pythons SequenceMatcher work?
body: <p>I am a little puzzled by two different answers returned by <a href="https://docs.python.org/2/library/difflib.html#sequencematcher-objects" rel="noreferrer"><code>SequenceMatcher</code></a> depending on the order of the arguments. Why is it so?</p>
  
  <h2>Example</h2>
  
  <p>SequenceMatcher is not commutative:</p>
  
  <pre><code>&gt;&gt;&gt; from difflib import SequenceMatcher
  &gt;&gt;&gt; SequenceMatcher(None, "Ebojfm Mzpm", "Ebfo ef Mfpo").ratio()
  0.6086956521739131
  
  &gt;&gt;&gt; SequenceMatcher(None, "Ebfo ef Mfpo", "Ebojfm Mzpm").ratio()
  0.5217391304347826
  </code></pre>