INNER CODE UNIT · Python

__init__

webartifex/intro-to-python · 11_classes/sample_package/matrix.py:30

    def __init__(self, data):
        """Create a new matrix.

        Args:
            data (sequence of sequences): the matrix's entries;
                viewed as a sequence of the matrix's rows (i.e., row-major order);
                use the .from_columns() class method if the data come as a sequence
                of the matrix's columns (i.e., column-major order)

        Raises:
            ValueError:
                - if no entries are provided
                - if the number of columns is inconsistent across the rows

        Example Usage:
            >>> Matrix([(1, 2), (3, 4)])
            Matrix(((1.0, 2.0,), (3.0, 4.0,)))
        """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…