Hi

I saw here http://inventwithpython.com/pygame/chapter3.html
a program where the main program is put in a function.

So the structure is:

def main():
  main code here

def f1():
   function 1 code

def f2():
  function 2 code

......

if __name__ == '__main__':
   main()



The author says that with this structure there are no
global variables (except when using "global' keyword)
and that the program can be loaded as a module without
be ran to test the function in the python shell.

is it advised to always write programs like that ?

thx
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to