(cls, partition)
return obj
Generates a new partition object.

        This method also verifies if the arguments passed are
        valid and raises a ValueError if they are not.

        Examples
        ========

        >>> from sympy.combinatorics.partitions import Partition
        >>> a = Partition([[1, 2], [3]])
        >>> a
        {{1, 2}, {3}}
        >>> a.partition
        [[1, 2], [3]]
        >>> len(a)
        2
        >>> a.members
        (1, 2, 3)
Generates a new partition object.
Generates a new partition object .
def __new__(cls, partition):
        """
        Generates a new partition object.

        This method also verifies if the arguments passed are
        valid and raises a ValueError if they are not.

        Examples
        ========

        >>> from sympy.combinatorics.partitions import Partition
        >>> a = Partition([[1, 2], [3]])
        >>> a
        {{1, 2}, {3}}
        >>> a.partition
        [[1, 2], [3]]
        >>> len(a)
        2
        >>> a.members
        (1, 2, 3)

        """
        args = partition
        if not all(isinstance(part, list) for part in args):
            raise ValueError("Partition should be a list of lists.")

        # sort so we have a canonical reference for RGS
        partition = sorted(sum(partition, []), key=default_sort_key)
        if has_dups(partition):
            raise ValueError("Partition contained duplicated elements.")

        obj = C.FiniteSet.__new__(cls, list(map(C.FiniteSet, args)))
        obj.members = tuple(partition)
        obj.size = len(partition)
        return obj
def __new__ ( cls , partition ) : args = partition if not all ( isinstance ( part , list ) for part in args ) : raise ValueError ( "Partition should be a list of lists." ) # sort so we have a canonical reference for RGS partition = sorted ( sum ( partition , [ ] ) , key = default_sort_key ) if has_dups ( partition ) : raise ValueError ( "Partition contained duplicated elements." ) obj = C . FiniteSet . __new__ ( cls , list ( map ( C . FiniteSet , args ) ) ) obj . members = tuple ( partition ) obj . size = len ( partition ) return obj