Class definition attribute order
gagsl-py2 at yahoo.com.ar
Tue Aug 5 04:38:23 CEST 2008
En Fri, 01 Aug 2008 23:47:42 -0300, Benjamin <musiccomposition at gmail.com>
> On Aug 1, 6:23 pm, Andrew Lentvorski <bs... at allcaps.org> 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 wait until Python 3.0 where you can do this sort of thing with
So the namespace that the metaclass receives when the class is created,
will be some kind of ordered dictionary?
Metaclasses are available for a long time ago, but the definition order is
lost right at the start, when the class body is executed. Will this step
be improved in Python 3.0 then?
More information about the Python-list