[Python-Dev] PEP 416: Add a frozendict builtin type

Victor Stinner victor.stinner at gmail.com
Sun Mar 4 10:30:11 CET 2012


> Is your implementation (adapted to a standalone type) something you
> could put up on the cheeseshop?

Short answer: no.

My implementation (attached to the issue #14162) reuses most of
private PyDict functins which are not exported and these functions
have to be modified to accept a frozendict as input.

One of the advantage of reusing PyDict functions is also to have a
frozendict type compatible with the PyDict (public) API:
PyDict_GetItem(), PyDict_SetItem(), etc. This property allows to do
further changes like accepting a frozendict for __builtins__ or use
freezing a type dict (use frozendict for type.__dict__).

If you only want to a frozendict type, you can copy/paste PyDict code
or implement it complelty differently. Or you can write a read-only
proxy.

Victor


More information about the Python-Dev mailing list