[Python-Dev] Unordered tuples/lists (original) (raw)
geremy condra debatem1 at gmail.com
Thu May 20 18:02:47 CEST 2010
- Previous message: [Python-Dev] Unordered tuples/lists
- Next message: [Python-Dev] Unordered tuples/lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] Unordered tuples/lists
- Next message: [Python-Dev] Unordered tuples/lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]