How can I call functions that are after the same function?

2

I have sometimes been able to call functions that are further ahead in the program. However, it takes hours to find a way to do it. What is the easiest way? Ex:

def paintball():
    print "Olá"
    adeus()

def adeus():
    print "Adeus"

It's just a simple way to show the problem.

    
asked by anonymous 16.06.2014 / 04:29

1 answer

3

This:

def paintball():
    print "Olá"
    adeus()

def adeus():
    print "Adeus"

paintball()

It works, after all, adeus() is before paintball() , and function name analysis is done only at runtime.

Now,

def paintball():
    print "Olá"
    adeus()

paintball()

def adeus():
    print "Adeus"

This is impossible because at the time of execution, the name adeus() was not evaluated at any time.

    
16.06.2014 / 05:39