[SciPy-dev] Suppressing of numpy __mul__, __div__ etc
Thu Dec 17 10:13:26 CST 2009
2009/12/17 Dmitrey <firstname.lastname@example.org>:
> От кого: Sebastian Walter <email@example.com>
> could you elaborate on why someone would
> want to do an `array * polynomial` operation and not expect it to
> be an array of polynomial as result?
> this has been already mentioned in the thread
> In : from numpy.polynomial import Polynomial as poly
> In : p = poly([0,1])
> In : ones(2) * p
> Out: array([poly([ 0. 1.], [-1. 1.]), poly([ 0. 1.], [-1. 1.])],
> In : p * ones(2)
> Out: Polynomial([ 0., 1., 1.], [-1., 1.])
let me rephrase then. I don't understand why p * ones(2) should give
Polynomial([ 0., 1., 1.], [-1., 1.]).
A polynomial over the reals is a data type with a ring structure and
should therefore behave "similarly" to floats IMHO.
> you would simply add
> class oofun:
> iscontainer = True
> to your oofun implementation and you would get exactly what you want....
> I guess "iscontainer" is a bad choice for the field, but if numpy developers
> decide to use this one, let it be, it doesn't matter for me sufficiently.
I'm just making suggestions ;). I'm as much numpy dev as you are...
> SciPy-Dev mailing list
More information about the SciPy-Dev