the codes as follow: class Base: def fun(self): print "base_fun" def fun2(self): print "base_fun2"
class Foo: def __init__(self, base): self.__base = base def fun3(self): print "foo_fun3" b = Base() foo = Foo(b) my aim is:when "foo.fun3()" be called,it run as usually, but when "foo.fun()" or "foo.fun2() be called, as Foo hasn't attribute "fun()" and "fun2()", foo will call "self.__base.fun()" or "self.__base.fun2()". when a attr can't be find in foo, it's will try to search 'self.__base". I think this maybe need to use "__getattr__" and "__setattr__" ,but I cant do it successfully. can someone help me? -- http://mail.python.org/mailman/listinfo/python-list