On Fri, Aug 1, 2008 at 7:23 PM, Andrew Lentvorski <[EMAIL PROTECTED]> wrote: > How do I determine the order of definition of class attributes? > > For example, if I have a class > > class Test(object): > y = 11 > x = 22 > > How do I tell that y was defined before x?
You can't. The order that the locals are bound is not something that's preserved. There are frameworks that simulate this, but they actually just store the order that the attributes are initialized: class Test(FrameworkClass): y = FrameworkObject(11) x = FrameworkObject(22) where FrameworkObject is assigned a number from an incrementing counter on initialization, and FrameworkClass has a metaclass that sorts those objects when the class is created. -Miles -- http://mail.python.org/mailman/listinfo/python-list