title: Why `__iter__` does not work when defined as an instance variable?
body: <p>If I define the <code>__iter__</code> method as follows, it won't work:</p>
  
  <pre><code>class A:
  
      def __init__(self):
          self.__iter__ = lambda: iter('text')
  
  
  for i in A().__iter__():
      print(i)
  
  iter(A())
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>t
  e
  x
  t
  Traceback (most recent call last):
    File "...\mytest.py", line 10, in &lt;module&gt;
      iter(A())
  TypeError: 'A' object is not iterable
  </code></pre>
  
  <p>As you can see, calling <code>A().__iter__()</code> works, but <code>A()</code> is not iterable.</p>
  
  <p>However if I define <code>__iter__</code> for the class, then it will work:</p>
  
  <pre><code>class A:
  
      def __init__(self):
  
          self.__class__.__iter__ = staticmethod(lambda: iter('text'))
          # or:
          # self.__class__.__iter__ = lambda s: iter('text')
  
  
  for i in A():
      print(i)
  
  iter(A())
  
  # will print:
  # t
  # e
  # x
  # t
  </code></pre>
  
  <p>Does anyone know why python has been designed like this? i.e. why <code>__iter__</code> as instance variable does not work? Don't you find it unintuitive?</p>