On Nov 27, 9:05 pm, Bruno Desthuilliers <bruno. [EMAIL PROTECTED]> wrote:
> The problem is that you often have more to do in the __main__ section of > a script than just calling one simple function, and you don't > necessarily want to pollute the module's namespace with all this code. As I said, it's probably just me ;) I'm not sure I understand, however, why calling multiple functions under 'if __name__ ...' will pollute the namespace if these functions are already defined there? Eg. def foo (arg) : #stuff return exit_status def bar (arg) : #stuff return exit_status def main (argv) : #parse args #call and do stuff with foo and bar return exit_status if __name__ == '__main__' : import sys sys.exit(main(sys.argv)) Doesn't this just pollute the namespace with main()? Surely you should be structuring the code above the test to minimise namespace pollution. -- http://mail.python.org/mailman/listinfo/python-list