Daniel Urban <urban.dani...@gmail.com> added the comment:

> Unless there is a reason I have missed, I would iterate through the
> smaller set, which might even be empty or nearly so, rather than
> either in particular.

You're right, here is a new patch. Pseudocode:

def isdisjoint(self, other):
    if self is other:
        if len(self) == 0:
            return True
        else:
            return False
    else:
        if len(other) > len(self):
            self, other = other, self
        for item in other:
            if item in self:
                return False
        return True

----------
Added file: http://bugs.python.org/file18172/issue9212a.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9212>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to