Python meta programming question
Posted
by
orokusaki
on Stack Overflow
See other posts from Stack Overflow
or by orokusaki
Published on 2010-12-22T06:38:09Z
Indexed on
2010/12/22
7:54 UTC
Read the original article
Hit count: 258
I have a meta class MyClass
which adds an attribute to a class based on some of the properties of the class's methods. When I subclass MyClass
I want it to still have that attribute, and append to the attribute's value based on the sub-class's methods (ie, sub-classing extends the same attribute that the base's meta creates.).
Can this be done via the bases
argument passed to __new__(cls, name, bases, dct)
?
© Stack Overflow or respective owner