title: How to return a generator from another function
body: <p>I have a generator function which I want to call from another function and return the generator obtained. I can see two approaches here - </p>
  
  <p><strong>Note that the below functions are simple dummy functions to illustrate the purpose. Please don't come up with better ways to implement those functions itself.</strong></p>
  
  Method 1
  
  <pre><code>def fun_a(n):
      for i in range(n):
          yield i+10
  
  def fun_b(n):
      if n &lt; 0: 
          yield None
          return
      yield fun_a(n)
  </code></pre>
  
  <p>and use it as <code>list(list(fun_b(10))[0])</code> to get <code>[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]</code></p>
  
  Method 2
  
  <pre><code>def fun_b(n):
      if n &lt; 0: 
          yield None
          return
      for i in fun_a(n):
          yield i
  </code></pre>
  
  <p>Then <code>list(fun_b(10))</code> can give me <code>[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]</code>. </p>
  
  <p>While method 1 seems ok'ish, I don't want to return a list of list because in other cases I am returning a list and I don't want to mess up my code. Method 2 is just inefficient. </p>
  
  <p>What would be a really good approach to deal with this situation?</p>