On Fri, Jul 10, 2009 at 5:52 PM, Tim wrote:
>
> Hi,
> I learned that a Python script is written in this way:
> def main():
> ...
> if __name__ == "__main__":
> main()
>
> Today, when I read a script, I found it has a different way:
>
> def main():
> ...
>
> main()
>
> It can run as well. C
On 2009-07-10, Tim wrote:
[RE-ORDERED]
> It can run as well. Can someone explain why and the rules that Python
> scripts get run?
Everything gets run by default. The def syntax defines functions but does
not run them -- they are only run when they are called
> Today, when I read a script, I fou