Hi, Thanks - this cookbook entry is very cool!
I am somewhat worried about function call overhead from the infix hack though... on second consideration, the infix issue is not as important as eventually boosting the speed of the inner loop to which matrixmultiply() belongs. For those who are interested in things like fast math, I found http://www.scipy.org/documentation/weave/weaveperformance.html very eye-opening. For many of the examples cited there, it is possible to simply treat the source as a string and then do the necessary macro transformations before passing it off to a compiler... David Robert Kern wrote: > David Pokorny wrote: > >>Hi, >> >>Just wondering if anyone has considered macros for Python. I have one >>good use case. In "R", the statistical programming language, you can >>multiply matrices with A %*% B (A*B corresponds to pointwise >>multiplication). In Python, I have to type >> >>import Numeric >>matrixmultiply(A,B) >> >>which makes my code almost unreadable. > > > Well, dot(A, B) is better. But if you must: > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122 > -- http://mail.python.org/mailman/listinfo/python-list