[Tutor] Notepad++ question
Alexander Quest
redacted@example.com
Fri Jun 15 00:17:01 CEST 2012
Got it Dave- sorry about not sending it to the newsgroup as well.
My question was regarding a piece of boilerplate code:
if __name__ == '__main__':
main()
This calls the main function, but I don't understand what the 'if'
statement is doing here. In the simple programs that I've seen this 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 be called by
typing main()- why do we need this if statement to precede it? Thanks.
-Alex
On Thu, Jun 7, 2012 at 6:16 PM, Dave Angel <d at davea.name> wrote:
> On 06/07/2012 02:36 PM, Alexander Quest wrote:
> > Ok, thanks guys. I also had one more quick question regarding a piece of
> > boilerplate code:
> >
>
> To get a response, you will needs to leave your question at the python
> tutor newsgroup. We are part of a group, not offering private advice.
>
> Normally, you just do a Reply-all to one of the existing messages on the
> thread, to include the group. But you can also type tutor at python.org
> as a CC:
>
> I've been volunteering my time on various forums for over 25 years now,
> so I think I speak for lots of other volunteers.
>
>
> --
>
> DaveA
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120614/0fc98471/attachment.html>
More information about the Tutor
mailing list
l>