* Guido van Rossum wrote: > On Thu, Mar 1, 2012 at 9:44 AM, Victor Stinner <victor.stin...@gmail.com> wrote: > > frozendict would help pysandbox but also any security Python module, > > not security, but also (many) other use cases ;-) > > Well, let's focus on the other use cases, because to me the sandbox > use case is too controversial (never mind how confident you are :-). > > I like thinking through the cache use case a bit more, since this is a > common pattern. But I think it would be sufficient there to prevent > accidental modification, so it should be sufficient to have a dict > subclass that overrides the various mutating methods: __setitem__, > __delitem__, pop(), popitem(), clear(), setdefault(), update().
For the caching part, simply making the dictproxy type public would already help a lot. > What other use cases are there? dicts as keys or as set members. I do run into this from time to time and always get tuple(sorted(items()) or something like that. nd -- s s^saaaaaoaaaoaaaaooooaaoaaaomaaaa a alataa aaoat a a a maoaa a laoata a oia a o a m a o alaoooat aaool aaoaa matooololaaatoto aaa o a o ms;s;\s;s;g;y;s;:;s;y#mailto: # \51/\134\137| http://www.perlig.de #;print;# > n...@perlig.de _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com