object inheritance

Anand anandology at gmail.com
Fri Oct 26 08:51:57 EDT 2007


On Oct 26, 5:31 pm, "Pradeep Jindal" <praddyjin... at gmail.com> 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..






More information about the Python-list mailing list