Simon Willison’s Weblog

Subscribe

3 items tagged “metaclasses”

2008

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 / django, inheritance, metaclasses, modelforms, multipleinheritance, newforms, python

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 / decorators, guido-van-rossum, idioms, metaclasses, monkeypatching, python

2006

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 / decorators, fuzzyman, metaclasses, python