On 20/05/2010 17:02, geremy condra wrote:
On Wed, May 19, 2010 at 1:56 AM, Gustavo Narea<m...@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.


-1 from me, a trivial implementation of an uncommon use case. At this point the discussion belongs on python-ideas anyway.

(The trouble with sorted is how it breaks with un-orderable types. There are at least two places now in the py3k standard library that have techniques for comparing sequences of heterogenous types - both prettyprint and unittest I believe. Perhaps a standard recipe for comparing or sorting such containers *does* belong somewhere more obvious.)

All the best,

Michael

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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of 
your employer, to release me from all obligations and waivers arising from any 
and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, 
clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and 
acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your 
employer, its partners, licensors, agents and assigns, in perpetuity, without 
prejudice to my ongoing rights and privileges. You further represent that you 
have the authority to release me from any BOGUS AGREEMENTS on behalf of your 
employer.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to