[Tutor] Which is better Practice and why

Devin Jeanpierre jeanpierreda at gmail.com
Tue Oct 23 02:25:12 CEST 2012


On Mon, Oct 22, 2012 at 6:15 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> Not that. That unconditionally executes main the first time you access
> the module, *regardless* of whether it is being run as a script or
> being imported. That is nearly always the wrong thing to do.

Recently I've become a fan of executable packages. In __main__.py,
it's always the right thing to do.

-- Devin


More information about the Tutor mailing list