我想知道放在 python 类顶部的声明是否等同于中的语句__init__
?例如
import sys
class bla():
print 'not init'
def __init__(self):
print 'init'
def whatever(self):
print 'whatever'
def main():
b=bla()
b.whatever()
return 0
if __name__ == '__main__':
sys.exit( main() )
输出是:
not init
init
whatever
作为旁注,现在我还得到:
Fatal Python error: PyImport_GetModuleDict: no module dictionary!
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
关于为什么会这样的任何想法?先感谢您!