title: Converting "yield from" statement to Python 2.7 code
body: <p>I had a code below in Python 3.2 and I wanted to run it in Python 2.7. I did convert it (have put the code of <code>missing_elements</code> in both versions) but I am not sure if that is the most efficient way to do it. Basically what happens if there are two <code>yield from</code> calls like below in upper half and lower half in <code>missing_element</code> function? Are the entries from the two halves (upper and lower) appended to each other in one list so that the parent recursion function with the <code>yield from</code> call and use both the halves together?</p>
  
  <pre><code>def missing_elements(L, start, end):  # Python 3.2
      if end - start &lt;= 1: 
          if L[end] - L[start] &gt; 1:
              yield from range(L[start] + 1, L[end])
          return
  
  index = start + (end - start) // 2
  
  # is the lower half consecutive?
  consecutive_low =  L[index] == L[start] + (index - start)
  if not consecutive_low:
      yield from missing_elements(L, start, index)
  
  # is the upper part consecutive?
  consecutive_high =  L[index] == L[end] - (end - index)
  if not consecutive_high:
      yield from missing_elements(L, index, end)
  
  def main():
      L = [10, 11, 13, 14, 15, 16, 17, 18, 20]
      print(list(missing_elements(L, 0, len(L)-1)))
      L = range(10, 21)
      print(list(missing_elements(L, 0, len(L)-1)))
  
  def missing_elements(L, start, end):  # Python 2.7
      return_list = []                
      if end - start &lt;= 1: 
          if L[end] - L[start] &gt; 1:
              return range(L[start] + 1, L[end])
  
      index = start + (end - start) // 2
  
      # is the lower half consecutive?
      consecutive_low =  L[index] == L[start] + (index - start)
      if not consecutive_low:
          return_list.append(missing_elements(L, start, index))
  
      # is the upper part consecutive?
      consecutive_high =  L[index] == L[end] - (end - index)
      if not consecutive_high:
          return_list.append(missing_elements(L, index, end))
      return return_list
  </code></pre>