[Python-Dev] PEP 416: Add a frozendict builtin type
victor.stinner at haypocalc.com
Thu Mar 1 13:23:26 CET 2012
>> 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)
"A frozendict is a read-only mapping: a key cannot be added nor
removed, and a key is always mapped to the same value. However,
frozendict values can be mutable (not hashable). A frozendict is
hashable and so immutable if and only if all values are hashable
>> * Register frozendict has a collections.abc.Mapping
> s/has/as/ ?
>> 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
I added two use cases: security sandbox and cache.
> Hope this is helpful
More information about the Python-Dev