Armin Ronacher <armin.ronac...@active-4.com> added the comment:

Maybe premature optimization but maybe it would make sense to implement
__eq__ like this:

def __eq__(self, other):
    if isinstance(other, OrderedDict):
        if not dict.__eq__(self, other):
            return False
        return all(p == q for p, q in _zip_longest(self.items(),
                                                   other.items()))
    return dict.__eq__(self, other)

For the most likely case (that dicts are different) this should give a
speedup.

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5397>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to