title: Why don't these two string equal each other?
body: <p>I'm trying to compare two strings in python and for some reason they just aren't matching.</p>
  
  <p>I've made sure there's no whitespace and they're both string types, but still no luck, even when they're exactly the same.</p>
  
  <pre><code>if versions['ksp_version'] is self.version:
  </code></pre>
  
  <p>The strings are both '1.0.2' and I've tried both <code>is</code> and <code>==</code> with no luck.</p>
  
  <p>Is there a better way to compare strings in python that I'm just missing?</p>
  
  <p>EDIT: Some more context.</p>
  
  <p>So, I added these lines and printed out the variables.</p>
  
  <pre><code>print versions['ksp_version']
  print type(versions['ksp_version'])
  print "===="
  print self.version
  print type(self.version)
  </code></pre>
  
  <p>And here's what we got.</p>
  
  <pre><code>1.0.2
  &lt;type 'str'&gt;
  ====
  1.0.2
  &lt;type 'str'&gt;
  </code></pre>
  
  <p>Based on that, they look the same. They both have been stripped of whitespace using <code>.strip()</code>.</p>