Find class attributes creation order

Michele Simionato michele.simionato at gmail.com
Mon Jun 23 18:53:38 CEST 2008


On Jun 23, 5:53 pm, Marcob <marcob... at gmail.com> wrote:
> Let's see these simple classes:
>
>     class base_foo()
>          pass
>
>     class foo(base_foo):
>          a=1
>          b={}
>          c="zz"
>
> I would like to find class foo attributes creation order.
> Using __metaclass__ is not of help because special method __new__
> receive attrs as a dictionary and so the order isn't preserved. Any
> other idea?

You need to wait for Python 3.0 metaclasses:

http://stacktrace.it/articoli/2008/01/metaclassi-python-3000/ which
you should know already (ciao Marco! ;-)

   Michele Simionato



More information about the Python-list mailing list