On 14/06/12 23:18, Alexander Quest wrote:

    so far, there is no variable called "_name_", and even if there was,
    why is it comparing it to "_main_"? Why can't the main function just

Note that in both cases there are two '_' characters before and after the name. __name__ and '__main__'. Double underscores usually indicates a special variable used by Python internally.

Thus __name__ is something that Python sets when the file is either imported or run, as others have already explained.

HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to