|
|
|
|
|
Why your main program should be importable ::: Daily Python-URL
2008-09-07Chris Siebenmann:
Why your main program should be importable
[ "When I first started coding in Python, I didn't know what I was doing. So I structured my Python programs the way I would write Bourne shell scripts or Perl programs, writing functions as necessary and useful but otherwise putting all of the logic and code in the program's file outside of functions (in what I now call 'module scope'). This is a perfectly rational structure for Python programs, and even works; my programs ran fine and were perfectly functional. But it was also a bad mistake, as I slowly discovered later; what you really want to do is put all of your code in functions (and then start one with magic)."] ::: back to daily-URL
|