Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>: > if __name__ == '__main__' or condition(): > print "still executing" > main() > > print "done loading" > > (I haven't ever done *all* of these things in a *single* file, but I > have done all these things at one time or another.) > > There's no way that any automatic system can match that for > flexibility or simplicity.
Our test system has this boilerplate at the end of each test case: if __name__ == '__main__': run(test) Nobody claims it's beautiful but nobody has been overly bothered by it, either. Marko -- https://mail.python.org/mailman/listinfo/python-list