I am trying to create a branch that backports all of my non-Risch Algorithm 
commits from my integration3 branch.  One commit, 
https://github.com/asmeurer/sympy/commit/846af4a187800a97520d771dc9e1223c2c16a11a,
 which is related to http://code.google.com/p/sympy/issues/detail?id=1991, 
changes the exceptions in the code of matrices.py a little bit.  I am not so 
sure now what the best way to have things is, though.  

Currently, there is a MatrixError exception, which is only used in one place in 
matrices.py, and there I believe ShapeError should be used instead.  All over 
the code there is "assert self.cols == self.rows".  I have replaced all of 
these with NonSquareMatrixError, which I for some reason have renamed 
NonSquareMatrixException to.  So my questions are:

1. Should we have MatrixError, and if so, how should it be structured?

2. Should it be called NonSquareMatrixError or NonSquareMatrixException?  It is 
raised in those cases where only a square matrix makes sense but a non-square 
matrix was given (like Matrix.det()).

The current structure of the exceptions is 

class NonSquareMatrixException(Exception):
    pass

class ShapeError(ValueError):
    """Wrong matrix shape"""
    pass

class MatrixError(Exception):
    pass

but I think it should be more like

class MatrixError(Exception):
    """
    If this is never raised directly, is it needed?
    """
    pass

class ShapeError(ValueError, MatrixError):
    """Wrong matrix shape"""
    pass

class NonSquareMatrixException(ShapeError):
    pass

Any suggestions?

Aaron Meurer

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to