On 2007-09-14, Martin v. Löwis wrote:
> >> That's a sorted dict. PEP 3115 wants an insertion-ordered dict.
> >> You're not the first to confuse them. ;)
> >
> > Hmmm, I'd not come across that terminology distinction before.
> > I guess I'll have to rename mine then.
>
> I think "insertion-ordered" is over-specification, just to make
> the distinction clear. Most of the time, people mean "ordered
> dictionary" to say "keys are in a fixed order" - typically insertion
> order. When they want to express that the keys ought to be
> sorted, they call it "sorted dictionary".
I got my terminology from C++ which has
C++ map => Python sorteddict (missing!)
C++ unordered_map => Python dict
C++ set => Python sortedset (missing!)
C++ unordered_set => Python set
I've now renamed mine to sorteddict:
http://pypi.python.org/pypi/sorteddict
As for Adam's comment about the dict API, I find it okay, and I think
some people would prefer a close match. Unfortunately, I don't think
there will ever be consensus (so that's why there's a BDFL), but
whatever their APIs, I hope that Python gets a sorteddict and a
sortedset. But how does this happen? I've discussed it on
comp.lang.python (having used ordereddict in the subject line to create
unintentional confusion), but at some point a PEP has to be created. I'm
happy to do that (at least for a sorteddict), but if someone who has
done PEPs before did so, I'd be just as happy---I'll see what the
feedback is (if any) when I get online again next week.
PS And no, I've never programmed in PHP and never fancied doing so:-)
--
Mark Summerfield, Qtrac Ltd., www.qtrac.eu
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com