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

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -