[Python-Dev] PEP 455: TransformDict
Antoine Pitrou
solipsis at pitrou.net
Tue Oct 8 10:34:45 CEST 2013
Le Tue, 8 Oct 2013 08:21:43 +0200,
Antoine Pitrou <solipsis at pitrou.net> a écrit :
>
> > 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.
More information about the Python-Dev
mailing list