title: Getting indices of True values in a boolean list
body: <p>I have a piece of my code where I'm supposed to create a switchboard. I want to return a list of all the switches that are on. Here "on" will equal <code>True</code> and "off" equal <code>False</code>. So now I just want to return a list of all the <code>True</code> values and their position. This is all I have but it only return the position of the first occurrence of <code>True</code> (this is just a portion of my code):</p>
  
  <pre><code>self.states = [False, False, False, False, True, True, False, True, False, False, False, False, False, False, False, False]
  
  def which_switch(self):
      x = [self.states.index(i) for i in self.states if i == True]
  </code></pre>
  
  <p>This only returns "4"</p>