sorteddict PEP proposal [started off as orderedict]

chris.monsanto at gmail.com chris.monsanto at gmail.com
Tue Sep 25 15:51:43 EDT 2007


On Sep 25, 1:35 pm, thebjorn <BjornSteinarFjeldPetter... at gmail.com>
wrote:
> On Sep 25, 10:53 am, Mark Summerfield <m.n.summerfi... at googlemail.com>
> wrote:
>
> > Hi,
>
> > Below is a PEP proposal for a sorteddict. It arises out of a
> > discussion on this list that began a few weeks ago with the subject of
> > "An ordered dictionary for the Python library?", and a similar one on
> > the P3K mailing list with the subject "ordered dict for p3k
> > collections?".
>
> > If there is positive feedback I will submit the PEP to the reviewers,
> > so if you think it is a good idea please say so. (I'm sure that if you
> > _don't_ like it you'll tell me anyway:-)
>
> I can't see much advantage over:
>
>   for key in sorted(mydict):
>       ...
>
> A much simpler data-structure, that is also very useful, is a
> dictionary that keeps insertion order -- it's also something that's a
> tad bit more difficult to implement yourself than the above. My
> personal implementation is documented athttp://blog.tkbe.org/archive/python-property-set/
> It's very tempting to add value access by numerical index (I did as
> well), however I now think it's a mistake.
>
> -1 from me.
>
> -- bjorn

I agree on both counts. When I saw this topic, I was hoping it would
be about a structure that remembers insertion order. Now if you
drafted a pep on THAT, I would stand behind it.




More information about the Python-list mailing list