Simon Willison’s Weblog

Subscribe
Atom feed for metaclasses

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

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

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