# check whether object is matrix

Hi,

I would like to check whether an object is a sage matrix. I thought that "isinstance" might help, however isinstance is a little bit too sensitive for my purpose as the following example shows:

```
m1=matrix([1.])
print type(m1)
print isinstance(m1, sage.matrix.matrix_generic_dense.Matrix_generic_dense)
m1=matrix([1])
print type(m1)
isinstance(m1, sage.matrix.matrix_generic_dense.Matrix_generic_dense)
```

returns

```
<type 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>
True
<type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
False
```

I would however like to obtain a function which recognizes a matrix regardless to the types of its entries.

```
isinstance(m1,matrix)
```

doesn't work either but gives the error: "isinstance() arg 2 must be a class, type, or tuple of classes and types"

So what else can I do?

Thanks for your answers, Tobias