__main__ : What is this?

Massimo Di Pierro mdipierro at cti.depaul.edu
Fri Oct 19 19:33:51 EDT 2007


if the .py file is imported as a module that condition is false else
(if the .py file is executed) that condition is true

On Oct 19, 2007, at 6:29 PM, Robert Dailey wrote:

> Hi,
>
> I've read various portions of the Python 2.5 documentation in an
> attempt to figure out exactly what the following condition represents:
>
> if __name__ == "__main__":
>     main()
>
> However, I was not able to determine what it is actually checking for.
> Could someone point me in the way of a tutorial or explain this for
> me? Thanks.
> --
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list