class BaseMetaClass(type):
record_cls = []
def __iter__(self):
return iter(BaseMetaClass.record_cls)
def __new__(cls, name, bases, attrs):
new_cls = type.__new__(cls, name, bases, attrs)
if name != 'Base':
BaseMetaClass.record_cls.append(name)
return new_cls
class Base(object, metaclass=BaseMetaClass):
pass
网友评论