python - Modifying ancestor nested Meta class in descendant -
suppose have:
class a(object): class meta: = "a parameter" class b(a): class meta: = "a parameter" b = "b parameter"
how can avoid having rewrite whole meta class, when want append b = "b parameter"
it?
you subclass a.meta
:
class b(a): class meta(a.meta): b = "b parameter"
now b.meta
inherits attributes a.meta
, , have declare overrides or new attributes.
Comments
Post a Comment