Discussion: new operators for numerical computation
Paul Barrett
Barrett at STScI.Edu
Thu Jul 20 18:12:18 EDT 2000
Perry Greenfield wrote:
> We are planning to use Numeric (or its future equivalent) heavily for
> our software. One thing we would strongly object to is making
> matrix operators the default. The vast majority of our manipulations
> (on images and spectra) involve elementwise operations. This would be
> consistent with what most astronomers would expect (and how IDL--currently
> the most commonly used array-based language in the astronomical community
> by far--handles it).
>
Note that IDL uses * as elementwise multiply and # has matrix multiply. The
latter, I find, fairly desciptive, ie. it looks like a matrix.
I would also suggest just using solve(A,B) for matrix solve. It's not that
long and its descriptive.
The one symbol in Python that I would like to see changed is ^ to mean
exponentiation, instead of **. The xor operation could be represented by !|
or &| .
The one issue that concerns me about this discussion is the continued narrow
focus to emulate Matlab syntax to the exclusion of more general N-dimensional
operations. I can see the need for some more general operators, but I'm not
for any of this, if all we're doing is defining 2-D Matlab syntax. I
suggest the Matlab people take a look at APL or J to get a broader
perspective of array languages.
More information about the Python-list
mailing list