コード例 #1
0
ファイル: set_importer.py プロジェクト: AwelEshetu/cwm
        def symmetric_difference(self, other):
            """Return the symmetric difference of two sets as a new set.

            (I.e. all elements that are in exactly one of the sets.)
            """
            data = {}
            value = True
            selfdata = self._data
            try:
                otherdata = other._data
            except AttributeError:
                otherdata = Set(other)._data
            for elt in ifilterfalse(otherdata.has_key, selfdata):
                data[elt] = value
            for elt in ifilterfalse(selfdata.has_key, otherdata):
                data[elt] = value
            return self.__class__(data)
コード例 #2
0
        def symmetric_difference(self, other):
            """Return the symmetric difference of two sets as a new set.

            (I.e. all elements that are in exactly one of the sets.)
            """
            data = {}
            value = True
            selfdata = self._data
            try:
                otherdata = other._data
            except AttributeError:
                otherdata = Set(other)._data
            for elt in ifilterfalse(otherdata.has_key, selfdata):
                data[elt] = value
            for elt in ifilterfalse(selfdata.has_key, otherdata):
                data[elt] = value
            return self.__class__(data)
コード例 #3
0
ファイル: set_importer.py プロジェクト: AwelEshetu/cwm
        def difference(self, other):
            """Return the difference of two sets as a new Set.

            (I.e. all elements that are in this set and not in the other.)
            """
            
            data = {}
            try:
                otherdata = other._data
            except AttributeError:
                otherdata = Set(other)._data
            value = True
            for elt in ifilterfalse(otherdata.has_key, self):
                data[elt] = value
            return self.__class__(data)
コード例 #4
0
        def difference(self, other):
            """Return the difference of two sets as a new Set.

            (I.e. all elements that are in this set and not in the other.)
            """

            data = {}
            try:
                otherdata = other._data
            except AttributeError:
                otherdata = Set(other)._data
            value = True
            for elt in ifilterfalse(otherdata.has_key, self):
                data[elt] = value
            return self.__class__(data)