Python 2.6.7; Windows 7python对象初始化期间的属性错误
在python中解决Deitel'Simple Compiler'练习。存储在github。编写测试套件。
module compiler.py
class SCompiler(object) :
RAMSIZE = 100
# more static attributes
def __init__(self) :
self.symbolTable = [ TableEntry() ] * SCompiler.RAMSIZE
self.lineFlags[ -1 ] * SCompiler.RAMSIZE
# more initializations
堆栈跟踪。
File "testCompiler.py", line 45, in <module>
tool = compiler.SCompiler()
File "absolutePath\compiler.py", line 37, in `__init__`
self.lineFlags[ -1 ] * SCompiler.RAMSIZE
AttributeError: 'SCompiler' object has no attribute 'lineFlags'
我不知道这里拼错了什么。文件'compiler.py'文件静静地编译。 TableEntry是文件中的另一个类。谢谢你的建议。