[Python-ideas] `OrderedDict.sort`

Ram Rachum ram at rachum.com
Tue Sep 24 17:23:58 CEST 2013


Ethan, you've misunderstood my message and given a correct objection to an
argument I did not make.

I did not argue against ordering by insertion order on init. I agree with
that decision. I disagree with defining the entire class as an insertion
ordering class and refusing to allow users to reorder it as they wish after
it's created.

Sent from my phone.
On Sep 24, 2013 4:42 PM, "Ethan Furman" <ethan at stoneleaf.us> wrote:

> On 09/24/2013 05:27 AM, Ram Rachum wrote:
>
>>
>> I think that your mistake is defining OrderedDict as a dict sorting by
>> insertion order. I see no reason to define it
>> that way [...]
>>
>
> How would you like it sorted?
>
>   - ascending?  you can write an algorithm for that
>
>   - descending?  you can write an algorithm for that
>
>   - cyclic?  you can write an algorithm for that
>
>   - insertion order?  you can *not* write an algorithm for that
>
> Insertion order is the one that you either remember, or is lost.
>
> As for a practical example, think of classes that want to know which order
> their attributes were created in -- OrderedDict to the rescue!  :)
>
> --
> ~Ethan~
> ______________________________**_________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/**mailman/listinfo/python-ideas<https://mail.python.org/mailman/listinfo/python-ideas>
>
> --
>
> --- You received this message because you are subscribed to a topic in the
> Google Groups "python-ideas" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**
> topic/python-ideas/-RFTqV8_**aS0/unsubscribe<https://groups.google.com/d/topic/python-ideas/-RFTqV8_aS0/unsubscribe>
> .
> To unsubscribe from this group and all its topics, send an email to
> python-ideas+unsubscribe@**googlegroups.com<python-ideas%2Bunsubscribe at googlegroups.com>
> .
> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130924/1900e7ac/attachment.html>


More information about the Python-ideas mailing list