我有这段代码:
class Attributes(object):
class __metaclass__(type):
def __init__(self, cls_name, cls_bases, cls_dict):
# super(Attributes.__metaclass__, self) # NameError: global name 'Attributes' is not defined
super(__metaclass__, self).__init__(
cls_name, cls_bases, cls_dict)
提供
NameError: global name '__metaclass__' is not defined
为什么__metaclass__
变量在外部作用域中找不到?
super
,它也不会起作用。你需要调用SimpleModel.Attributes
来解决这个问题。 - Games Brainiac