Re: [Tutor] Question about __name__ global variable (Was: Tutor Digest, Vol 35, Issue 27)

2007-01-09 Thread Luke Paireepinart
raghu raghu wrote: i have a clarification regarding built in function,in some scripts it is being used and it is give n: if _name_ == '_main_' why this is being used in the scripts? The global variable __name__ is equal to '__main__' when the python script is run. If the script is imported,

Re: [Tutor] Question about __name__ global variable (Was: Tutor Digest, Vol 35, Issue 27)

2007-01-09 Thread wesley chun
The global variable __name__ is equal to '__main__' when the python script is run. If the script is imported, __name__ is something other than '__main__' (not sure what.) it will be the name of your module. so for foo.py, if you execute it (as a script), __name__ == '__main__', but if you