Why would I prefer metaclass over inheritance from a superclass in Python
<p>From what I've learned so far, metaclass and inheritance from superclass in Python serve a very similar purpose, but superclass inheritance is more powerful.</p>

<p>Why would I prefer metaclass over superclass inheritance? In what kind of case metaclass would be helpful?</p>

<p>Sorry if there is any wrong assumption. I just learned metaclass today. </p>

<p>I think you've misunderstood. Inheritance is the classic object oriented technique of reusing code by putting the commonly used stuff in a base class and deriving from that. </p>

<p>Metaclasses in a nutshell) allow you to customise the process of creation of a class (specifically the <code>__new__</code> method) so that you can dynamically add attributes and things like that. It's a little complicated and in most cases, you won't need this. There are some details over at this answer <a href="http://stackoverflow.com/questions/100003/what-is-a-metaclass-in-python#6581949">What is a metaclass in Python?</a></p>

python class inheritance superclass metaclass