some basic questions...

Russell Blau russblau at
Mon Sep 20 18:53:09 CEST 2004

"Player" <guess at> wrote in message
news:cimv3o$a51$1 at
> [book quote]
> When a file containing python code is executed, the built in variable
> is populated with the name of the module being executed. If the value of
> _name_ is _main_, then that file is the original file that was used to
> invoke the application from command line or an icon.
> This is usefull, as it allows code to know the difference between when it
> invoked & when it is imported by another python program. It is also
> a convenient place to provide one-time startup code.
> [end quote]

Actually it is '__name__' and '__main__', with *two* _ characters both
before and after.  You need to be careful about the underscores when using
built-in names like these, because typing them with just one _ will not work
at all!

As for how to use __name__ and the importing modules question, I suggest you

I don't actually read my hotmail account, but you can replace hotmail with
excite if you really want to reach me.

More information about the Python-list mailing list