<story><title>Improve Your Python: Metaclasses and Dynamic Classes With Type</title><url>http://www.jeffknupp.com/blog/2013/12/28/improve-your-python-metaclasses-and-dynamic-classes-with-type/</url></story><parent_chain><item><author>JulianWasTaken</author><text>As he says himself at the end, these aren&amp;#x27;t used very often because they aren&amp;#x27;t very useful.&lt;p&gt;The example at the end is perfectly well written using the class statement and using register as a class decorator, while being more familiar and readable.&lt;p&gt;It gets tiring to hear people say &amp;quot;oh advanced Python? Like metaclasses, I&amp;#x27;ll learn that&amp;quot;.&lt;p&gt;Learn useful things instead, like writing readable, testable code.</text></item></parent_chain><comment><author>reuven</author><text>Whenever I teach a course in advanced Python, the people asking for the training specifically request&amp;#x2F;demand that I talk about metaclasses.  This is almost certainly because they (1) want an advanced class, and (2) metaclasses are advanced.  So yeah, I cover them to some degree in my courses, but I give plenty of advance warning that we&amp;#x27;re looking at this because it&amp;#x27;s fascinating to see how some of the deeper recesses of Python classes work, not because this will truly be useful.&lt;p&gt;Sure enough, when I&amp;#x27;m done with my explanation, the participants agree that metaclasses are really something that they&amp;#x27;re not planning to touch or use.  And then I repeat my claim (which isn&amp;#x27;t original with me at all) that decorators are easier to understand and maintain, and should be used instead.&lt;p&gt;I totally agree that learning to write readable, testable code is a far better use of time.  (I include that in my classes, too... but people rarely request that, I&amp;#x27;m afraid...)</text></comment>
<story><title>Improve Your Python: Metaclasses and Dynamic Classes With Type</title><url>http://www.jeffknupp.com/blog/2013/12/28/improve-your-python-metaclasses-and-dynamic-classes-with-type/</url></story><parent_chain><item><author>JulianWasTaken</author><text>As he says himself at the end, these aren&amp;#x27;t used very often because they aren&amp;#x27;t very useful.&lt;p&gt;The example at the end is perfectly well written using the class statement and using register as a class decorator, while being more familiar and readable.&lt;p&gt;It gets tiring to hear people say &amp;quot;oh advanced Python? Like metaclasses, I&amp;#x27;ll learn that&amp;quot;.&lt;p&gt;Learn useful things instead, like writing readable, testable code.</text></item></parent_chain><comment><author>pdonis</author><text>&lt;i&gt;The example at the end is perfectly well written using the class statement&lt;/i&gt;&lt;p&gt;No, it can&amp;#x27;t, because the name of the class is dynamically determined at run time. The class statement can&amp;#x27;t take a variable for the name of the class. That&amp;#x27;s the point.</text></comment>