If the module is run as a program, then the __name__ is assigned the value __main__ . If the module is imported, then the value is not assigned.
Please see here - http://stackoverflow.com/questions/419163/what-does-if-name-main-do <http://stackoverflow.com/questions/419163/what-does-if-name-main-do> On Fri, May 20, 2011 at 4:39 PM, Ganesh Kumar <bugcy...@gmail.com> wrote: > Hi Gurus, > > I am new python programming.. I see many programs > if __name__ == '__main__': > when I check __name__ always eq __main__. > what purpose use these structure.. please guide me.. > > -Ganesh > > -- > Did I learn something today? If not, I wasted it. > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- http://spawgi.wordpress.com We can do it and do it better.
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor