Re: Putting the main program in a main function

2015-09-14 Thread Ben Finney
"ast" writes: > 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 ? Writing

Re: Putting the main program in a main function

2015-09-14 Thread Nobody
On Mon, 14 Sep 2015 09:13:47 +0200, ast wrote: > is it advised to always write programs like that ? If global (module-scope) variables are initialised by main, then those variables won't exist unless main() is run, which means that you can't use it as a module, only as a script. IMHO, global var