Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Monkeypatching idioms - elegant or ugly? Guido offers a decorator and a metaclass as syntactic sugar for monkeypatching existing Python classes.

Tagged , , , , ,

2 comments

  1. Incidentally, I have a slightly fancier version of this in magicset (though frankly I've never used it, I just wrote it to be clever).

    Ian Bicking - 30th January 2008 06:09 - #

  2. This is really weird. I always thought meta-classes have to be classes themselves (typically a class which sub-classes 'type'). But Guido's meta-class (monkeypatch_class) is a function?

    Harish Mallipeddi - 30th January 2008 16:01 - #

Comments are closed.
A django site