title: Can I be warned when I used a generator function by accident
body: <p>I was working with generator functions and private functions of a class. I am wondering</p>
  
  <ol>
  <li>Why when yielding (which in my one case was by accident) in __someFunc that this function just appears not to be called from within __someGenerator. Also what is the terminology I want to use when referring to these aspects of the language?</li>
  <li>Can the python interpreter warn of such instances? </li>
  </ol>
  
  <p>Below is an example snippet of my scenario.</p>
  
  <pre><code>class someClass():
      def __init__(self):
          pass
  
      #Copy and paste mistake where yield ended up in a regular function
      def __someFunc(self):
          print "hello"
          #yield True #if yielding in this function it isn't called
  
      def __someGenerator (self):
          for i in range(0, 10):
              self.__someFunc()
              yield True
          yield False
  
      def someMethod(self):
          func = self.__someGenerator()
          while func.next():
              print "next"
  
  sc = someClass()
  sc.someMethod()
  </code></pre>
  
  <p>I got burned on this and spent some time trying to figure out why a function just wasn't getting called. I finally discovered I was yielding in function I didn't want to in.</p>