我想不出解决这个问题:
class Clazz:
EMPTY=Clazz1(None,None)
def __init__(self):
self.item=Clazz1("a","b")
class Clazz1:
def __init__(self,key,value):
self.key=key
self.value=value
if __name__=='__main__':
h=Clazz()
当我尝试运行它返回:
Traceback (most recent call last):
File "C:\Users\Desktop\test.py", line 1, in <module>
class Clazz:
File "C:\Users\Desktop\test.py", line 2, in Clazz
EMPTY=Clazz1(None,None)
NameError: name 'Clazz1' is not defined
任何想法?提前致谢