How to stop python recursion
<p>I made a function that searches files recursively and I want it to stop recursion when the first file is found:  </p>

<pre><code>def search_file(path):
    for name in os.listdir(path):
        sub = os.path.join(path, name)
        if os.path.isfile(sub):
            return sub#And break recursion
        else:
            search_file(sub)
</code></pre>