frozendict
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Wed Feb 8 21:01:40 EST 2012
On Wed, 08 Feb 2012 19:23:19 -0600, Evan Driscoll wrote:
> Hi all,
>
> I've been trying for a few days (only a little bit at a time) to come up
> with a way of implementing a frozendict that doesn't suck. I'm gradually
> converging to a solution, but I can't help but think that there's some
> subtlety that I'm probably missing which is why it's not already
> provided.
>
> Does anyone know why Python doesn't already come with a frozendict, or
> why there seem to only be a couple attempts to write one?
Because there is no way to implement one that doesn't suck?
Because it's a solution in search of a problem?
<shrug>
Actually, that's unfair. A write-once dict would be awesome for providing
read-only constants, if only there were some way to set a namespace to
using non-builtin dicts.
--
Steven
More information about the Python-list
mailing list