title: Removing elements that have consecutive duplicates
body: <p>I was curios about the question: <a href="http://stackoverflow.com/questions/5729572/eliminate-consecutive-duplicates-of-list-elements">Eliminate consecutive duplicates of list elements</a>, and how it should be implemented in Python.</p>
  
  <p>What I came up with is this:</p>
  
  <pre><code>list = [1,1,1,1,1,1,2,3,4,4,5,1,2]
  i = 0
  
  while i &lt; len(list)-1:
      if list[i] == list[i+1]:
          del list[i]
      else:
          i = i+1
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>[1, 2, 3, 4, 5, 1, 2]
  </code></pre>
  
  <p>Which I guess is ok.</p>
  
  <p>So I got curious, and wanted to see if I could delete the <strong>elements</strong> that had consecutive duplicates and get this output:</p>
  
  <pre><code>[2, 3, 5, 1, 2]
  </code></pre>
  
  <p>For that I did this:</p>
  
  <pre><code>list = [1,1,1,1,1,1,2,3,4,4,5,1,2]
  i = 0
  dupe = False
  
  while i &lt; len(list)-1:
      if list[i] == list[i+1]:
          del list[i]
          dupe = True
      elif dupe:
          del list[i]
          dupe = False
      else:
          i += 1
  </code></pre>
  
  <p>But it seems sort of clumsy and not pythonic, do you have any smarter / more elegant / more efficient way to implement this?</p>