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/2009-March/086606.html below:

[Python-Dev] PEP 372 -- Adding an ordered directory tocollectionsready for pronouncement

[Python-Dev] PEP 372 -- Adding an ordered directory tocollectionsready for pronouncement [Python-Dev] PEP 372 -- Adding an ordered directory tocollectionsready for pronouncementRaymond Hettinger python at rcn.com
Mon Mar 2 21:07:59 CET 2009
Compromise?

     def __eq__(self, other):
        if isinstance(other, OrderedDict):
            return all(map(operator.eq, self.items(), other.items()))
        if isinstance(other, Mapping):
            return dict.__eq__(self, other)
        return NotImplemented # Give other a chance; defaults to False

OrderedDict-to-OrderedDict comparisons are order sensitive -- matching your intuition
OrderedDict-to-OtherMappings -- allow me and Armin to have our substitutability for dicts.


Raymond
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