[Tutor] Need help with a couple of concepts

Gerrit Holl gerrit@nl.linux.org
Fri, 3 Mar 2000 20:32:17 +0100

<quote name="Robin B. Lake" date="952089204" email="rbl@hal.cwru.edu">
> Long-time programming.  Understand most of the Python *language*.
> Need help with some of the constructs to get a Python program going.
> Running Python on a Mac G3.
> 1.  Am modifying some code.  There is at the bottom:
> if __name__ == '__main__':
> 	main()
> and after the imports:
> def main():
> What is this all about?

If a Python program is run as a script, the value of the __name__
variable is set to '__main__'; this is not executed if the program
is imported as a Python module.



Plies korekt enie bet ingglisj joe encauntur in mai imil mesusj!
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE?
Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y