__name__
放在Modules模块中,表示模块的名字
放在Class类中,表示类的名字
__main__
脚本的主模块的名称为__main__
eg.
建立一个模块:mymath.py
def square(x):
return x*x
print "test: square(42)==",square(42);#用于调试
如果我在其他程序中调用此模块:
>>> import mymath;
test:square(42)== 1764
显示出了mymath中调试的部分,而这一部分我们并不希望在其他调用者调用时出现