示例#1
0
    def __init__(self, *elements):
        """Initialize a new instance.

        Parameters
        ----------
        element1, ..., elementN : `Set`
            The elements in the set. Any duplicates are ignored.

        Examples
        --------
        >>> set = odl.FiniteSet(1, 'string')
        """
        self.__elements = tuple(unique(elements))
示例#2
0
    def __init__(self, *sets):
        """Initialize a new instance.

        Parameters
        ----------
        set1, ..., setN : `Set`
            The sets whose intersection should be taken.
            Any duplicates are ignored.

        Examples
        --------
        >>> reals, complexnrs = odl.RealNumbers(), odl.ComplexNumbers()
        >>> union = odl.SetIntersection(reals, complexnrs)
        """
        for set_ in sets:
            if not isinstance(set_, Set):
                raise TypeError('{!r} is not a Set instance.'.format(set_))

        self.__sets = tuple(unique(sets))