Simon Willison’s Weblog

3 items tagged “metaclasses”

Multiple inheritance of newforms and modelforms. If you ever see “Error when calling the metaclass bases metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases” when trying multiple inheritance with newforms and modelforms, here’s a scary solution I found. # 12th April 2008, 12:54 pm

Monkeypatching idioms—elegant or ugly? Guido offers a decorator and a metaclass as syntactic sugar for monkeypatching existing Python classes. # 30th January 2008, 12:39 am

Meta-classes Made Easy. Fuzzyman introduces a metaclass factory for applying a decorator to every method of a class. # 17th December 2006, 12:42 am