[SciPy-user] can basearray using somehow be tried already?

Robert Kern robert.kern@gmail....
Fri Mar 23 14:48:23 CDT 2007

Perry Greenfield wrote:
> On Mar 23, 2007, at 3:08 PM, Robert Kern wrote:
>> dmitrey wrote:
>>> first of all I'm very interested in operators (matmult, dotmult  
>>> etc) -
>>> will they have MATLAB/Octave/omatrix/etc -like style
>>> dot is present => dotwise operation
>>> dot is absent => matrix operation
>>> or other?
>> No, we do not have the ability to change Python's syntax to add  
>> operators. For
>> the array object, operators all act element-wise. numpy also  
>> provides a matrix
>> object based on the array object which implements the relevant  
>> operators as
>> matrix operations (e.g. * is a matrix multiplication rather than  
>> element-wise
>> multiplication).
> While strictly true, there was a cool hack a while back that had  
> nearly the same effect. I forget if it was looked into and found  
> wanting for this purpose. Perhaps someone remembers if there was a  
> reason this couldn't be used (or wouldn't be considered symbolic  
> enough).

What do you mean by "used"? There's no reason an individual couldn't use it, no.
It's entirely decoupled from anything else; i.e. no one else has to modify
anything in order to support it. Personally, I think the hack is pretty cool,
but its verbosity and precedence problems prevent me from actually using it.
Unfortunately, I think it simply doesn't solve the problem and creates more
magic in the process. I wouldn't want to see such pseudo-operators added to
numpy, for example.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the SciPy-user mailing list