if __name__ == "__main__"

Henrik Motakef henrik at moskau.hmotakef.homeip.net
Wed Dec 19 16:21:51 EST 2001

Greg Ewing <greg at cosc.canterbury.ac.nz> writes:

> > (hmmm... what will it be, never thought about it?).
> The name of the module!


Python 2.1.1 (#1, Dec  3 2001, 18:53:22) 
[GCC 2.95.3 20010125 (prerelease)] on openbsd3
Type "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.__name__
>>> import sys as foo
>>> foo.__name__

Why isn't foo.__name__ not 'foo', exactly?

Henrik Motakef

More information about the Python-list mailing list