[Tutor] Which is better Practice and why
eryksun at gmail.com
Mon Oct 22 15:12:34 CEST 2012
On Mon, Oct 22, 2012 at 7:54 AM, Devin Jeanpierre
<jeanpierreda at gmail.com> wrote:
> The second one is used if your importable modules are also scripts
> that can be executed.
> That's a bad idea, because it results in the same source file being
> executed twice, producing distinct classes that break typechecking.
Here's an exception to the above. On Windows, multiprocessing requires
you to gate the setup in "__main__" since the module is re-imported in
each new process (win32 doesn't fork).
More information about the Tutor