Hygenic Macros

Robert Kern robert.kern at gmail.com
Tue Oct 18 01:37:31 EDT 2005


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

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Python-list mailing list