calling a function before its definition in python
<p>Is there any way to call a function before its definition.</p>

<pre><code>def Insert(value):
    """place value at an available leaf, then bubble up from there"""
    heap.append(value)
    BubbleUp(len(heap) - 1)

def BubbleUp(position):
    print 'something'
</code></pre>

<p>This code shows "unresolved reference BubbleUp"</p>

<p>The code here doesn't show anything, least of all an error, because neither of the functions is called. What matters is the location of the call to <code>Insert</code>, and as long as it comes after <code>BubbleUp</code> (and why wouldn't it), there is no issue. Function <em>definitions</em> don't execute the function body, so you can define functions in whatever order you like, as long as you refrain from calling any of them until all necessary functions are defined.</p>

python