[Python-Dev] Unordered tuples/lists
geremy condra
debatem1 at gmail.com
Thu May 20 18:02:47 CEST 2010
On Wed, May 19, 2010 at 1:56 AM, Gustavo Narea <me at gustavonarea.net> wrote:
> Hello, Oleg.
>
>>
>> class UnorderedList(list):
>> def __eq__(self, other):
>> if not isinstance(other, UnorderedList):
>> return False
>> return sorted(self) == sorted(other)
>>
>> def __ne__(self, other):
>> return not self.__eq__(other)
>>
>> Do you need more than that?
>>
>> Oleg.
>
> That's what I had in mind.
>
> I think it'd be useful enough to go in the standard library. Now that
> there's a sample implementation, should I still try to demonstrate why I
> believe it's worth adding to the stdlib and get support?
>
> Cheers,
>
> - Gustavo.
I'm generally in favor of adding more data structures to Python,
but I'm at best -0 on this. Besides being trivial to code and
questionably useful, a much better implementation could be
written using heap.
Maybe with a better implementation I would go +0, but I'm
hard pressed to see a case where this would be needed and
could not be trivially written.
Geremy Condra
More information about the Python-Dev
mailing list