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

konrad.hinsen at laposte.net konrad.hinsen at laposte.net
Thu Mar 17 09:08:07 CST 2005


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.
--
------------------------------------------------------------------------ 
-------
Konrad Hinsen
Laboratoire Leon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: khinsen at cea.fr
------------------------------------------------------------------------ 
-------





More information about the Numpy-discussion mailing list