[Python-Dev] Add a frozendict builtin type (original) (raw)
Mark Shannon mark at hotpy.org
Tue Feb 28 10:47:59 CET 2012
- Previous message: [Python-Dev] Add a frozendict builtin type
- Next message: [Python-Dev] Add a frozendict builtin type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Victor Stinner wrote:
The blacklist implementation has a major issue: it is still possible to call write methods of the dict class (e.g. dict.set(myfrozendict, key, value)). It is also possible to use ctypes and violate even more invariants. For most purposes, this falls under "consenting adults". My primary usage of frozendict would be pysandbox, a security module. Attackers are not consenting adults :-) Read-only dict would also help optimization, in the CPython peephole or the PyPy JIT.
Not w.r.t. PyPy. It wouldn't do any harm though.
One use of frozendict that you haven't mentioned so far is communication between concurrent processes/tasks. These need to be able to copy objects without changing reference semantics, which demands immutability.
Cheers, Mark.
- Previous message: [Python-Dev] Add a frozendict builtin type
- Next message: [Python-Dev] Add a frozendict builtin type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]