(A, B)
Get the type of the result when combining matrices of different types.

    Currently the strategy is that immutability is contagious.

    Examples
    ========

    >>> from sympy import Matrix, ImmutableMatrix
    >>> from sympy.matrices.matrices import classof
    >>> M = Matrix([[1, 2], [3, 4]]) # a Mutable Matrix
    >>> IM = ImmutableMatrix([[1, 2], [3, 4]])
    >>> classof(M, IM)
    <class 'sympy.matrices.immutable.ImmutableMatrix'>
Get the type of the result when combining matrices of different types.
Get the type of the result when combining matrices of different types .
def classof(A, B):
    """
    Get the type of the result when combining matrices of different types.

    Currently the strategy is that immutability is contagious.

    Examples
    ========

    >>> from sympy import Matrix, ImmutableMatrix
    >>> from sympy.matrices.matrices import classof
    >>> M = Matrix([[1, 2], [3, 4]]) # a Mutable Matrix
    >>> IM = ImmutableMatrix([[1, 2], [3, 4]])
    >>> classof(M, IM)
    <class 'sympy.matrices.immutable.ImmutableMatrix'>
    """
    try:
        if A._class_priority > B._class_priority:
            return A.__class__
        else:
            return B.__class__
    except:
        pass
    try:
        import numpy
        if isinstance(A, numpy.ndarray):
            return B.__class__
        if isinstance(B, numpy.ndarray):
            return A.__class__
    except:
        pass
    raise TypeError("Incompatible classes %s, %s" % (A.__class__, B.__class__))
def classof ( A , B ) : try : if A . _class_priority > B . _class_priority : return A . __class__ else : return B . __class__ except : pass try : import numpy if isinstance ( A , numpy . ndarray ) : return B . __class__ if isinstance ( B , numpy . ndarray ) : return A . __class__ except : pass raise TypeError ( "Incompatible classes %s, %s" % ( A . __class__ , B . __class__ ) )