Popular recipes by Ariel Balter http://code.activestate.com/recipes/users/4172249/2009-11-09T07:59:53-08:00ActiveState Code RecipesSimple, if naive, class factory recipe in python (Python) 2009-11-09T07:59:53-08:00Ariel Balterhttp://code.activestate.com/recipes/users/4172249/http://code.activestate.com/recipes/576951-simple-if-naive-class-factory-recipe-in-python/ <p style="color: grey"> Python recipe 576951 by <a href="/recipes/users/4172249/">Ariel Balter</a> (<a href="/recipes/tags/class_factory/">class_factory</a>). Revision 2. </p> <p>I'm a hack programmer -- no formal education. So, I don't know if this is technically a "factory", "abstract factory" or something else.</p> <p>It is a way to generate a class dynamically, perhaps based on run-time data.</p> <p>The point is that you can take a blank class object and dynamically add a constructor, class attributes, and instance methods. In principle, these could be configured dynamically in a program.</p> <p>Since I don't know anything about programming theory, I welcome any criticism/discussion/suggestion. But, please be gentle!</p>