On Fri, Jul 25, 2008 at 12:06 AM, Scott Dial <[EMAIL PROTECTED]> wrote:
> Perhaps I'm nobody, but I think this would be ridiculous. Matrices are > not native objects to the language. There is no type(matrix). The notion > of what makes a Python object a matrix is a convention and to have > built-in operators dedicated to such objects makes no sense. There are > multiple ways to stuff matrices into Python. Please submit a PEP for a > type(matrix) first. Until a matrix is a first-order object in Python, > there is no logic to making operators for them. Though I would personally find a matrix multiplication operator useful, I have to agree with this. Anyway, it is easy to define pseudo-operators in Python; just create an Operator class and implement its __mul__ and __rmul__ methods appropriately (there are recipes for this around somewhere). Then you can define various custom multiplication operators with syntax like this: A *matrixmul* B A *dot* B A *cross* B A *elementwise* B Some other fun possibilities: A +concat+ B A /solve/ B A **left_inverse** (-1) A **right_inverse** (-1) x **tetrate** y n |choose| k Fredrik _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com