[Python-Dev] PEP 416: Add a frozendict builtin type (original) (raw)

David Malcolm dmalcolm at redhat.com
Wed Feb 29 19:52:28 CET 2012


On Wed, 2012-02-29 at 19:21 +0100, Victor Stinner wrote:

As requested, I create a PEP and a related issue:

http://www.python.org/dev/peps/pep-0416/

[...snip...]

Rationale ========= A frozendict mapping cannot be changed, but its values can be mutable (not hashable). A frozendict is hashable and so immutable if all values are hashable (immutable). The wording of the above seems very unclear to me.

Do you mean "A frozendict has a constant set of keys, and for every key, d[key] has a specific value for the lifetime of the frozendict. However, these values may be mutable. The frozendict is hashable iff all of the values are hashable." ? (or somesuch)

[...snip...]

* Register frozendict has a collections.abc.Mapping s/has/as/ ?

[...snip...]

If frozendict is used to harden Python (security purpose), it must be implemented in C. A type implemented in C is also faster.

You mention security purposes here, but this isn't mentioned in the Rationale or Use Cases

Hope this is helpful Dave



More information about the Python-Dev mailing list