Jess Austin schrieb:
> >>> frozenset([1]) == mySet()
> False
> 
> frozenset doesn't use mySet.__eq__() because mySet is not a subclass
> of frozenset as it is for set.

You could just overwrite set and frozenset:

class eqmixin(object):
    def __eq__(self, other):
        print "called %s.__eq__()" % self.__class__
        if isinstance(other, (set, frozenset)):
            return True
        return super(eqmixin, self).__eq__(other)

class set(eqmixin, set):
    pass
class frozenset(eqmixin, frozenset):
    pass
class MySet(set):
    pass


Regards,
Mick.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to