[Python-Dev] Add a frozendict builtin type

Victor Stinner victor.stinner at gmail.com
Fri Mar 2 12:36:05 CET 2012


> I think you should provide stronger arguments in each case why the
> data needs to be truly immutable or read-only, rather than just using
> a convention or an "advisory" API (like __private can be circumvented
> but clearly indicates intent to the reader).

I only know one use case for "truly immutable or read-only" object
(frozendict, "read-only" type, read-only proxy, etc.): security. I
know three modules using a C extension to implement read only objects:
zope.proxy, zope.security and mxProxy. pysandbox uses more ugly tricks
to implement read-only proxies :-) Such modules are used to secure web
applications for example. A frozendict type doesn't replace these
modules but help to implement security modules.

http://www.egenix.com/products/python/mxBase/mxProxy/
http://pypi.python.org/pypi/zope.proxy
http://pypi.python.org/pypi/zope.security

Victor


More information about the Python-Dev mailing list