def classof(A, B):
 try:
  if (A._class_priority > B._class_priority):
   return A.__class__
  else:
   return B.__class__
 except Exception:
  pass
 try:
  import numpy
  if isinstance(A, numpy.ndarray):
   return B.__class__
  if isinstance(B, numpy.ndarray):
   return A.__class__
 except Exception:
  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 Exception : pass try : import numpy if isinstance ( A , numpy . ndarray ) : return B . __class__ if isinstance ( B , numpy . ndarray ) : return A . __class__ except Exception : pass raise TypeError ( ( 'Incompatible classes %s, %s' % ( A . __class__ , B . __class__ ) ) )
get the type of the result when combining matrices of different types .