This isn't code of mine, it's probably from the cookbook, maybe with little changes:
| def addMethod(object, method, name=None): | if name is None: name = method.func_name | class newclass(object.__class__): | pass | setattr(newclass, name, method) | object.__class__ = newclass name is the name for the new method, if it's None then the name of "method" is used. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list