Order of execution and style of coding in Python
- by Jason
Hi guys.
I am new to Python so please don't flame me if the question is too basic :)
I have read that Python is executed from top - to - bottom.
If this is the case, why do programs go like this:
def func2():
def func1(): #call func2()
def func() #call func1()
if __name__ == '__main__': call func()
So from what I have seen, the main function goes at last and the other functions are stacked on top of it.
Am I wrong in saying this? If no, why isn't the main function or the function definitions written from top to bottom?