On Friday 26 Oct 2007 6:21:57 pm Anand wrote: > On Oct 26, 5:31 pm, "Pradeep Jindal" <[EMAIL PROTECTED]> wrote: > > Can you tell any specific use case for doing this? > > I have many implementaions of a db interface. > > SimpleDB - simple implementation > BetterDB - optimized implementation > CachedDB - an implementation with caching of queries > RestrictedDB - implementation with permissions > > Now, I want to combine these implementations and use. > Typical use case scenarios are: > > db = RestrictedDB(CachedDB(SimpleDB())) > db = RestrictedDB(SimpleDB()) > db = RestrictedDB(BetterDB()) > db = RestrictedDB(CachedDB(BetterDB()) > db = CachedDB(SimpleDB()) > etc..
I agree with Duncan. According to me, this should be called Delegation rather than inheritance. And delegation should work without any conflicts of identifier names and all that. I think, it should be all about several objects implementing a protocol (interface) and that should work cleanly. -- http://mail.python.org/mailman/listinfo/python-list