[Numpy-discussion] new __wrap_array__ magic method

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Aug 11 22:08:10 CDT 2005


Sebastien.deMentendeHorne at electrabel.com wrote:

> __wrap_array__(self, ufunc): # all unary operators like __neg__, __abs__, __invert__
> __lwrap_array__(self, other, ufunc): # all binary operators called with self on the lhs like __add__, __mul__, __pow__
> __rwrap_array__(self, other, ufunc): # all binary operators called with self on the rhs like __radd__, __rmul__, __rpow__

The term "wrap_array" doesn't seem very descriptive of
what these are for. Wrapping of arrays may come into the
implementations of them, but it's not the main point.
The point is to apply a ufunc to the object and get
an appropriate result.

Maybe just __ufunc__, __lufunc__, __rufunc__?

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+




More information about the Numpy-discussion mailing list