我搞不清楚这个非常简单的代码片段有什么问题:
class A(object):
def printme(self):
print "A"
self.printme()
a = A()
错误输出:
Traceback (most recent call last): File "prog.py", line 1, in
<module>
class A(object): File "prog.py", line 5, in A
self.printme() NameError: name 'self' is not defined