Why are there no ordered dictionaries?
bokr at oz.net
Wed Nov 23 05:07:30 CET 2005
On 22 Nov 2005 19:15:42 -0800, "bonono at gmail.com" <bonono at gmail.com> wrote:
>Alex Martelli wrote:
>> However, since Christoph himself just misclassified C++'s std::map as
>> "ordered" (it would be "sorted" in this new terminology he's now
>> introducing), it seems obvious that the terminological confusion is
>> rife. Many requests and offers in the past for "ordered dictionaries"
>> (e.g. on this group) were also "sorted", NOT "ordered", in this new
>> Maybe it would therefore be clearer to have the name of the new
>> container reflect this, with a specific mention of *insertion* order...
>> rather than just call it "ordered" and risk probable confusion.
>what would be the definition of "sorted" and "ordered", before we can
>go on ?
For me the implication of "sorted" is that there is a sorting algorithm
that can be used to create an ordering from a prior state of order,
whereas "ordered" could be the result of arbitrary permutation, e.g.,
manual shuffling, etc. Of course either way, a result can be said
to have a particular defined order, but "sorted" gets ordered
by sorting, and "ordered" _may_ get its order by any means.
More information about the Python-list