如何在Python中获取类属性的定义顺序?

如何在Python中获取类属性的定义顺序?

我想定义应该代表数据结构的轻量级类.与许多数据结构的情况一样,数据的顺序很重要.所以,如果我继续定义: class User(DataStructure): username = StringValue() password = StringValue() age = IntegerValue() 我暗示这是一个数据结构,其中首先是带有用户名