if __name__ == "__main__"

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


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

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

BTW:

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__
'sys'
>>> import sys as foo
>>> foo.__name__
'sys'

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

Regards,
Henrik Motakef



More information about the Python-list mailing list