[Numpy-discussion] new __wrap_array__ magic method

Travis Oliphant oliphant at ee.byu.edu
Wed Aug 10 10:02:11 CDT 2005

Sebastien.deMentendeHorne at electrabel.com wrote:

>Currently, we have an __array__ magic method that can be used to transform any object that implements it into an array.
>It think that a more useful magic method would be, for ufuncs, a __wrap_array__ method that would return an array object and a function to use after having applied the ufunc.
There is an interest in doing this but it is a bit more complicated for 
ufuncs with more than one input argument and more than one output argument.

I have not seen a proposal that really works.    Your __wrap_array__ 
method sounds interesting though.   I think, however, that the 
__wrap_array__ method would need to provide some kind of 
array_interfaceable object to be really useful.

In the new scipy.base, I've been trying to handle some of this, but it 
is more complicated than it might at first appear.


More information about the Numpy-discussion mailing list