Returning Functions or Values: recursive python functions
<p>Would anyone be willing to explain why the first does not work, but the second does?  </p>

<p>In the first, the function calculates the final, adjusted value...</p>

<pre><code># returns None
def _pareRotation(degs):
    if degs &gt; 360:          
        _pareRotation(degs - 360)
    else:
        print "returning %s" % degs
        return degs
</code></pre>

<p>...but returns <code>None</code>:</p>

<pre><code>print _pareRotation(540)
&gt;&gt; returning 180
&gt;&gt; None
</code></pre>

<p>However, if we flip things a bit and return the function...</p>

<pre><code># returns expected results
def _pareRotation(degs):
    if degs &lt; 360:          
        print "returning %s" % degs     
        return degs
    else:
        return _pareRotation(degs - 360)
</code></pre>

<p>...it works as expected:</p>

<pre><code>print _pareRotation(540)
&gt;&gt; returning 180
&gt;&gt; 180
</code></pre>

<p>Mostly, wondering what causes that <code>None</code> to get ejected from the recursive loop?</p>