class OrderedTypeMeta(type):

    def __new__(mcls, clsname, bases, clsdict):
        attrs = clsdict.get('_attrs_', [])
attrnames = []
for name, value in attrs:
    clsdict[name] = value
How do I get the definition order of class attributes in Python?