[Python-ideas] Identity dicts and sets (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Thu Jan 3 08:06:49 CET 2013


On Thu, 3 Jan 2013 13:37:40 +1000 Nick Coghlan <ncoghlan at gmail.com> wrote:

On Thu, Jan 3, 2013 at 8:48 AM, Terry Reedy <tjreedy at udel.edu> wrote: > On 1/2/2013 9:01 AM, Serhiy Storchaka wrote: >> >> I propose to add new standard collection types: IdentityDict and >> IdentitySet. They are almost same as ordinal dict and set, but uses > > > What do you mean by ordinal dict, as opposed to plain dict.

I assumed Serhiy meant OrderedDict.

I'm quite sure Serhiy meant ordinary dict.

As noted elsewhere, we already have a nasty composition problem between missing, order preservation and weak referencing.

Aren't you dramatizing a bit? I haven't seen anyone ask for an ordered weak dict, or a weak dict with default values.

So, -1 from me on making the composition problem worse, but tentative +0 on an API that addresses the composition problem and also includes "key=func" style support for using a decorated value in the lookup step.

Well, IdentityDict addresses an actual use case. I don't think a defaultidentitydict addresses any use case.

Regards

Antoine.



More information about the Python-ideas mailing list