8 Oct
2013
8 Oct
'13
8:34 a.m.
Le Tue, 8 Oct 2013 08:21:43 +0200,
Antoine Pitrou
I think there *is* a potentially worthwhile generalisation here, but I'm far from sure "is-a-dict" is the right data model - for composability reasons, it feels like a "has-a" relationship with an underlying data store may make more sense.
It doesn't work. Your "underlying mapping" can show too much variation for the wrapper/proxy to have sane semantics. For example, how do you combine with a defaultdict or a WeakKeyDictionary, knowing that the wrapper/proxy has to have its own internal mapping as well?
(for the record, I'm saying that because I did try the composition route.) Regards Antoine.