【发布时间】:2018-09-26 05:43:42
【问题描述】:
我有类sprite 和内部类type。
class sprite:
class type:
ThisValue = 10
OtherValue = 22
def __init__(self, type = sprite.type.ThisValue):
self.type = type
当我尝试这个时,它说名称 sprite 没有定义;错误在def __init__() 行上引发。如何在函数定义中访问ThisValue?有没有更好的方法来编写type 类?
【问题讨论】: