On 2007-03-20, gtb <[EMAIL PROTECTED]> wrote:
> I often see the following 'if' construct in python code. What does
> this idiom accomplish?
It checks to see if the file is being run as the "main"
program, and does something if that is so.
> What happens if this is not main?
Nothing.
> How did I get here if it is not main?
By importing the file.
> if __name__ == 'main':
> myQuest('myQuest').Run()
>
--
Grant Edwards grante Yow! Thank god!!... It's
at HENNY YOUNGMAN!!
visi.com
--
http://mail.python.org/mailman/listinfo/python-list