title: Can a method within a class be generator?
body: <p>Is it acceptable/Pythonic to use a method in a class as a generator? All the examples I have found show the yield statement in a function, not in a class. </p>
  
  <p>Here is an example working code:</p>
  
  <pre><code>class SomeClass(object):
      def first_ten(self):
          for i in range(10):
              yield i
  
      def test(self):
          for i in self.first_ten():
              print i
  
  SomeClass().test()
  </code></pre>