title: How to make a custom object iterable?
body: <p>I have a <code>list</code> of custom-class objects (sample is below). </p>
  
  <p>Using: <code>list(itertools.chain.from_iterable(myBigList))</code> I wanted to "merge" all of the <code>stations</code> sublists into one big list. So I thought I need to make my custom class an iterable. </p>
  
  <p>Here is a sample of my custom class. </p>
  
  <pre><code>class direction(object) :
      def __init__(self, id) :
          self.id = id              
          self.__stations = list()
  
      def __iter__(self):
          self.__i = 0                #  iterable current item 
          return iter(self.__stations)
  
      def __next__(self):
          if self.__i&lt;len(self.__stations)-1:
              self.__i += 1         
              return self.__stations[self.__i]
          else:
              raise StopIteration
  </code></pre>
  
  <p>I implemented <code>__iter__</code> and <code>__next__</code> but it doesn't seems to work. They're not even called. </p>
  
  <p>Any idea what could I've done wrong?   </p>
  
  <p>Note: Using Python 3.3 </p>