title: Python recursion return differs
body: <p>The return of a python recusion differs and I do not understand why:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  
  
  def recurse_table(table, table_list):
      if table.find_next("table") is not None:
          recurse_table(table.find_next("table"), table_list)
      table_list.append(table)
      return table_list
  
  
  fp = open("tc4400_cs_2.html")
  soup = BeautifulSoup(fp.read(), features="html.parser")
  print(len(recurse_table(soup.find("table"), [])))
  </code></pre>
  
  <p>returns correct length (4).</p>
  
  <p>Whereas</p>
  
  <pre><code>from bs4 import BeautifulSoup
  
  
  def recurse_table(table, table_list):
      if table.find_next("table") is not None:
          recurse_table(table.find_next("table"), table_list)
      return table_list.append(table)
  
  
  fp = open("tc4400_cs_2.html")
  soup = BeautifulSoup(fp.read(), features="html.parser")
  print(len(recurse_table(soup.find("table"), [])))
  </code></pre>
  
  <p>returns TypeError: object of type 'NoneType' has no len()</p>
  
  <p>What am I missing?</p>