On 2014-03-26 18:59, Sturla Molden wrote:
On 14/03/14 18:53, Guido van Rossum wrote:
- Did you consider a duck-typing (is that the word?) attribute? E.g. a*b is elementwise multiplication; a.M*b must be used for matrix multiplication.
This is exactly what has been tried with the types numpy.matrix and numpy.array.
For the record, no it hasn't. The proposal here is different than the numpy.matrix status quo. The proposed result of `a.M*b` would be an ndarray, not whatever the .M type is. The .M type would not be intended to be used outside of a multiplication expression. It is unlikely to propagate through ones code the way that numpy.matrix does (at least, it would be considered a bug to let a free .M type loose). One could safely write their functions expecting only numpy.ndarrays. While this proposal has been considered and rejected, it is not the same as numpy.matrix and has been rejected for different reasons. -- 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