title: Python class accessible by iterator and index
body: <p>Might be a n00b question, but I currently have a class that implements an iterator so I can do something like </p>
  
  <pre><code>for i in class():
  </code></pre>
  
  <p>but I want to be able to access the class by index as well like </p>
  
  <pre><code>class()[1]
  </code></pre>
  
  <p>How can I do that?</p>
  
  <p>Thanks!</p>