def __iter__(self):
        """
        Returns an iterator returning each of the disjoint sets as a list.
        """
        seen = set()
        for elem, group in self._mapping.items():
            if elem not in seen:
                yield group
                seen.update(group)
def __iter__ ( self ) : seen = set ( ) for elem , group in self . _mapping . items ( ) : if elem not in seen : yield group seen . update ( group )
Returns an iterator returning each of the disjoint sets as a list.