main in mac?

Park997 park997 at aol.comnotospam
Tue Mar 13 12:32:30 EST 2001


>I don't know what the run all button is (not on mac), but the whole reason
>for this idiom is so it wont 'do anything' when imported. If a file named
>x.py is imported, then it's __name__ is x. If it is being run as a program,
>then it's __name__ is __main__. 
>
>
>David

I knew that was the expected behavior, and the
disadvantage of replacing if __name__ is __main__. 
with if 1: is that it does run when imported. Turning the run as main option on
or off produces the expected behavior on the mac.

Incidently, I am very impressed with the mac Python
port. It must have been pretty tricky moving everything to a no command prompt
system.

Wendell



More information about the Python-list mailing list