title: python list __iter__ method called on every loop?
body: <p>I am trying to make a class which inherits from a python list. I want the elements of the list to be initialized/finalized with every loop of the list. I thought this could be done by overriding the <code>__iter__</code> method of the python list but I can't seem to get it to work. The <code>__iter__</code> method appears to called only once ? (see below)</p>
  
  <pre><code>class MyList(list):
      def __iter__(self):
          print 'do something'
          return list.__iter__(self)
  
  my_list = MyList(range(10))
  print my_list
  
  for item in my_list:
      print item
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  do something
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
  </code></pre>
  
  <p>Any idea how I can achieve what I want to do?</p>