PEP 603: Adding a frozenmap type to collections

I think that Raymond’s suggestion of exposing the mappingproxy wrapper
(with or without a new name) is an excellent idea worth considering, but
there is one pretty critical difference between the proxy and a “real”
frozendict: if you have a reference to the underlying dictionary, you
can mutate the proxy.

>>> mappingproxy = type(vars(object))
>>> d = {}
>>> e = mappingproxy(d)  # a frozen, immutable dict, right?
>>> d[None] = "Surprise!"
>>> e
mappingproxy({None: 'Surprise!'})

I fear that this will become a “Gotcha” and a FAQ “Why can you mutate
frozen dicts?”.

Additionally, the proxies aren’t hashable, so that would need to change
if we are to support the “dict as key” use-case (and I think we should).

Still, we already have mappingproxy, so this is a low-impact change that
lets us dip our toe in the water, without committing to a whole new
data type. Expose the mappingproxy, make it hashable, and see if that
solves the use-cases for frozendict.