<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Having read previous discussions on python-dev I think I'm not the only > Python programmer who doesn't particularly like python's "self" > parameter: >
How about this decorator-based approach (still need to pick *some* name for self, I picked "__"). -- Paul def memberFunction(f): def func(self,*args,**kwargs): globals()["__"] = self return f(*args,**kwargs) func.__name__ = f.__name__ func.__doc__ = f.__doc__ func.__dict__.update(f.__dict__) return func class Test: @memberFunction def __init__(x,y): __.x = x __.y = y @memberFunction def mult(): "Multiply the two member vars" return __.x * __.y t = Test(5,4) print t.mult() print dir(t) print t.mult.__doc__ -- http://mail.python.org/mailman/listinfo/python-list