[Python-Dev] Add a frozendict builtin type

Steven D'Aprano steve at pearwood.info
Thu Mar 1 02:28:41 CET 2012


Raymond Hettinger wrote:
> On Feb 27, 2012, at 10:53 AM, Victor Stinner wrote:
> 
>> A frozendict type is a common request from users and there are various
>> implementations. 
> 
> ISTM, this request is never from someone who has a use case.
> Instead, it almost always comes from "completers", people
> who see that we have a frozenset type and think the core devs
> missed the ObviousThingToDo(tm).  Frozendicts are trivial to 
> implement, so that is why there are various implementations
> (i.e. the implementations are more fun to write than they are to use).

They might be trivial for *you*, but the fact that people keep asking for help 
writing a frozendict, or stating that their implementation sucks, demonstrates 
that for the average Python coder they are not trivial at all. And the 
implementations I've seen don't seem to be so much fun as *tedious*.

E.g. google on "python frozendict" and the second link is from somebody who 
had tried for "a couple of days" and is still not happy:

http://python.6.n6.nabble.com/frozendict-td4377791.html

You may dismiss him as a "completer", but what is asserted without evidence 
can be rejected without evidence, and so we may just as well declare that he 
has a brilliantly compelling use-case, if only we knew what it was... <wink>

I see one implementation on ActiveState that has at least one serious problem, 
reported by you:

http://code.activestate.com/recipes/414283-frozen-dictionaries/


So I don't think we can dismiss frozendict as "trivial".



-- 
Steven



More information about the Python-Dev mailing list