from functools import partial class Point: def __init__(self, x, y): self.x, self.y = x, y
def show(self, n): for i in range(n): print "Point: (%s, %s)" % (self.x, self.y) def new_method(obj, func): def method(*args, **kw): return func(obj, *args, **kw) return method p1 = Point(1, 2) p2 = Point(3, 4) def show(self, n): print "Not a Point: %s-%s" % (self.x, self.y) p2.show = partial(show, p2) p1.show(3) p2.show(3) HTH, -- Miki <[EMAIL PROTECTED]> http://pythonwise.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list