ram at rachum.com
Tue Sep 24 18:02:12 CEST 2013
On Tue, Sep 24, 2013 at 6:36 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 09/24/2013 08:23 AM, Ram Rachum wrote:
>> On Sep 24, 2013 4:42 PM, Ethan Furman 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 [...]
>>> Insertion order is the one that you either remember, or is lost.
>> 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.
> Two points:
> - What happens when a new element is added to the OrderedDict after the
> user sorts it?
The exact same thing that happens if the user does `.move_to_end` and then
adds a new element, and the exact same thing that happens when a user does
`list.sort` and adds a new element, and the exact same thing that happens
when a user does `sorted(whatever)` and adds a new element. It just gets
put in the end.
> - If by 'init' you mean something like `d = OrderedDict(a=1, b=2, c=3)`
> this does not preserve an insertion order as the keywords end up in a
> regular, unsorted dict that is passed to OrderedDict.__init__
Does this relate to my proposal in any way? I don't see how. (I meant
__init__, I was typing from a phone.)
> Python-ideas mailing list
> Python-ideas at python.org
> --- 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/**
> 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...
More information about the Python-ideas