Scott David Daniels wrote:
...
Look into metaclasses:
...
    class Initialized(ClassBase):
        @classmethod
        def _init_class(class_):
            class_.a, class_.b = 1, 2
            super(Initialized, class_)._init_class()

Mea culpa:  Here super is _not_ a good idea, and I had tried that
and recoded, but cut and pasted the wrong code.  I just noticed
that I had done so this morning.

    class Initialized(ClassBase):
        @classmethod
        def _init_class(class_):
            class_.a, class_.b = 1, 2
            ClassBase._init_class()

    print Initialized.a, Initialized.b

Much better.  There is probably a way to get to the MRO, but for now,
this should do.

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to