title: Is there any legitimate use of list[True], list[False] in Python?
body: <p>Since <code>True</code> and <code>False</code> are instances of <code>int</code>, the following is valid in Python:</p>
  
  <pre><code>&gt;&gt;&gt; l = [0, 1, 2]
  &gt;&gt;&gt; l[False]
  0
  &gt;&gt;&gt; l[True]
  1
  </code></pre>
  
  <p>I understand why this happens. However, I find this behaviour a bit unexpected and can lead to hard-to-debug bugs. It has certainly bitten me a couple of times.</p>
  
  <p>Can anyone think of a legit use of indexing lists with <code>True</code> or <code>False</code>?</p>