title: Python string identity: `is` and `in` statements
body: <p>I had some problems getting this to work:</p>
  
  <pre><code># Shortened for brevity
  def _coerce_truth(word):
      TRUE_VALUES = ('true','1','yes')
      FALSE_VALUES = ('false','0','no')
  
      _word = word.lower().strip()
      print "t" in _word
      if _word in TRUE_VALUES:
          return True
      elif _word in FALSE_VALUES:
          return False
  </code></pre>
  
  <p>I discovered:</p>
  
  <pre><code>In [20]: "foo" is "Foo".lower()
  Out[20]: False
  
  In [21]: "foo" is "foo".lower()
  Out[21]: False
  
  In [22]: "foo" is "foo"
  Out[22]: True
  
  In [23]: "foo" is "foo".lower()
  Out[23]: False
  </code></pre>
  
  <p>Why is this? I understand that identity is different then equality, but when is identity formed? Statement 22 should be <code>False</code> unless, due to the static nature of strings, id == eq. In this case I'm confused by statement 23. </p>
  
  <p>Please explain and thanks in advance.</p>