title: How does Python know where the end of a function is?
body: <p>I'm just learning python and confused when a "def" of a function ends?</p>
  
  <p>I see code samples like:</p>
  
  <pre><code>def myfunc(a=4,b=6):
      sum = a + b
      return sum
  
  myfunc()
  </code></pre>
  
  <p>I know it doesn't end because of the return (because I've seen if statements... if FOO than return BAR, else return FOOBAR).  How does Python know this isn't a recursive function that calls itself?  When the function runs does it just keep going through the program until it finds a return?  That'd lead to some interesting errors.</p>
  
  <p>Thanks</p>