This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aronacher
Recipients aronacher, georg.brandl, jimjjewett, pitrou, rhettinger
Date 2009-03-02.21:41:10
SpamBayes Score 5.167998e-07
Marked as misclassified No
Message-id <1236030072.15.0.247790959202.issue5397@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-03-02 21:41:12aronachersetrecipients: + aronacher, georg.brandl, rhettinger, jimjjewett, pitrou
2009-03-02 21:41:12aronachersetmessageid: <1236030072.15.0.247790959202.issue5397@psf.upfronthosting.co.za>
2009-03-02 21:41:10aronacherlinkissue5397 messages
2009-03-02 21:41:10aronachercreate