A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-May/100212.html below:

[Python-Dev] Unordered tuples/lists

[Python-Dev] Unordered tuples/listsgeremy 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4