title: == and is in python
body: <p>Its been a couple of days since I started learning python, at which point I stumbled across the <code>==</code> and <code>is</code>. Coming from a java background I assumed <code>==</code> does a comparison by object id and <code>is</code> by value, however doing </p>
  
  <pre><code> &gt;&gt;&gt; a = (1,2)
   &gt;&gt;&gt; b = (1,2)
   &gt;&gt;&gt; a is b
   False
   &gt;&gt;&gt; a == b
   True
  </code></pre>
  
  <p>Seems like <code>is</code> is equivalent of java's <code>==</code> and python's <code>==</code> is equivalent to java's <code>equals()</code>. Is this the right way to think about the difference between <code>is</code> and <code>==</code>? Or is there a caveat?</p>