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 - #

Sign in with OpenID

Auto-HTML: Line breaks are preserved; URLs will be converted in to links.

Manual XHTML: Enter your own, valid XHTML. Allowed tags are a, p, blockquote, ul, ol, li, dl, dt, dd, em, strong, dfn, code, q, samp, kbd, var, cite, abbr, acronym, sub, sup, br, pre

A django site