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
_______________________________________________
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