title: Tail recursive function fails to return a value (Python 3)
body: <p>I've created a tail recursive function to solve an optimization problem:</p>
  
  <pre><code>def optimize(current_price = 0.1, last_profit = 0.0):
      current_profit = profit(current_price)
      if (last_profit &gt; current_profit) and (current_profit &gt; 0.0):
          return {'best_price': current_price - 0.1, 'best_profit': last_profit}
          # print({'best_price': current_price - 0.1, 'best_profit': last_profit})
      else:
          optimize(current_price + 0.1, current_profit)
  
  def best_price():
      optimized = optimize() # optimize() should return a dict, 
                             # allowing optimized['best_price'] 
                             # and optimized['best_profit'] to be called
      print("Pricing the tickets at ${0} will produce the greatest profit, ${1}.".format(optimized['best_price'], optimized['best_profit']))
  </code></pre>
  
  <p>The function operates correctly with the exception that it fails to return anything. I do not mean to say that the first <code>if</code> statement is never called (in fact, when I uncomment the print line, it will print the correct result), but that the return statement fails to return a dictionary.</p>
  
  <p>This results in a <code>TypeError</code> when I attempt to call <code>optimized['best_price']</code>, as <code>'NoneType' object is not subscriptable</code>.</p>
  
  <p>I've been working on this error for a while now, and can't seem to either make it work myself or find anything regarding it online. At this point, it's just a matter of me wanting to know the solution. Any ideas? Thanks!</p>