[Python-ideas] Revisiting Immutable Mappings
rosuav at gmail.com
Thu Oct 11 11:45:30 EDT 2018
On Fri, Oct 12, 2018 at 2:41 AM Chris Barker - NOAA Federal via
Python-ideas <python-ideas at python.org> wrote:
> > This violates the Liskov Substitution Principle.
> If we REALLY had a time machine, then dict would subclass frozendict,
> and we’d be all set.
Thanks to virtual subclassing, we can still do this. The question is, should we?
Intuition tells me that a frozen dictionary is a form of dictionary
that adds restrictions, not that a dictionary is a frozen dictionary
that you left out to thaw. But as we see from [frozen]set, it's
probably best to treat them as completely independent classes, both
implementing the basic Mapping interface.
More information about the Python-ideas