[SciPy-user] subclassing matrix

Travis Oliphant oliphant at ee.byu.edu
Sat Apr 9 12:47:07 EDT 2005


BORGULYA Gábor wrote:

>Hi List!
>
>I would like to subclass the matrix class to add a method 'as_html' which 
>generates a html table displaying the matrix.
>Could anyone tell me what the problem is with the following code?
>
>  
>
>>>>from scipy import *
>>>>class mat2(mat):
>>>>        
>>>>
>...   pass
>...
>Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>TypeError: __init__() takes exactly 3 arguments (4 given)
>  
>

The delayed import mechanism means that mat is not the same thing as the 
Matrix.Matrix class.  Try

import Matrix
class mat2(Matrix.Matrix):
         pass





More information about the SciPy-User mailing list