I just have a basic style question here. Suppose you have the program:
def foo1():
do something
def foo2()
do something else
Assume that you want to call these functions at execution. Is it more
proper to call them directly like:
foo1()
foo2()
or in an if __name__ == __main__: ?
The difference becomes clear when you import your program into another
program (or the command line python editor). __name__!='__main__' when
you import, so the functions will not be called if they're inside the
block. This is why you see this block so often at the end of scripts;
so that the
Brian wrote:
I just have a basic style question here. Suppose you have the program:
def foo1():
do something
def foo2()
do something else
Assume that you want to call these functions at execution. Is it more
proper to call them directly like:
foo1()
foo2()
or in an if