def __eq__(self, other): """ python.org: The correspondence between operator symbols and method names is as follows: x==y calls x.__eq__(y) :param other: Object to be compaired with :return: (bool) True if equal :since: v2.1.0 """ return (isinstance(other, EnvironmentDict) and Mapping.__eq__(self, other))
def __eq__(self, other): """ Generated by @autodict. In the case the other is of the same type, use the dict comparison. Otherwise, falls back to super. :param self: :param other: :return: """ # in the case the other is of the same type, use the dict comparison, that relies on the appropriate fields if isinstance(other, cls): return dict(self) == dict(other) elif isinstance(other, Mapping): return dict(self) == other else: # else fallback to inherited behaviour, whatever it is try: f = super(cls, self).__eq__ except AttributeError: # can happen in python 2 when adding Mapping inheritance failed return Mapping.__eq__(dict(self), other) else: return f(other)