Hygenic Macros
Steven D'Aprano
steve at REMOVETHIScyber.com.au
Tue Oct 18 09:32:15 EDT 2005
On Mon, 17 Oct 2005 22:23:43 -0700, 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.
Yes, I see what you mean, it is pretty confusing. It almost looks like
a function that multiplies two matrices and returns the result.
Have you tried coming up with better names for your arguments than A and
B? Many people find that using self-documenting variable names helps make
code easier to understand.
--
Steven.
More information about the Python-list
mailing list