[Numpy-discussion] Please chime in on proposed methods for arrays

Perry Greenfield perry at stsci.edu
Thu Mar 17 09:54:33 CST 2005


On Mar 17, 2005, at 12:05 PM, konrad.hinsen at laposte.net wrote:

> On 17.03.2005, at 06:08, Robert Kern wrote:
>
>> I'm too lazy to search right now, but I'm pretty sure that Konrad 
>> suggested the opposite: that x.sin(), while possibly "cleaner" in an 
>> OO-fetishistic sense, jars too much against the expectation of sin(x) 
>> that all of us got accustomed to in math class. Maybe I should let 
>> him speak for himself, though.  :-)
>
> I agree. What I suggested is that there should be methods as well as 
> functions, and that the ufuncs should call the methods, such that
>
> 	Numeric.sin(x)
>
> would simply become syntactic sugar for
>
> 	x.sin()
>
> whatever the type of x. But I don't expect to see x.sin() in 
> application code, it's just a convenient way of implementing sin() in 
> new classes and subclasses. Actually, x.__sin__() would be a more 
> pythonic choice of method name.
>
> Konrad.
>
It would be hard to imagine not allowing the functional form. Users 
would think we were crazy. (And they'd be right ;-)

Perry





More information about the Numpy-discussion mailing list