What is __array_wrap__ supposed to do?
Because it doesn't do what it says it does. In [31]: b.__array_wrap__(a).dtype Out[31]: dtype('float64') In [32]: a.__array_wrap__(b).dtype Out[32]: dtype('int8') In [33]: a Out[33]: array([[ 1., 1., 1.], [ 1., 1., 1.], [ 1., 1., 1.]]) In [34]: b Out[34]: array([[1, 1, 1], [1, 1, 1], [1, 1, 1]], dtype=int8) Here is what the docstring says: Help on method_descriptor: __array_wrap__(...) a.__array_wrap__(obj) -> Object of same type as a from ndarray obj. Chuck
On Sat, Apr 26, 2008 at 9:27 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
Because it doesn't do what it says it does.
Here is what the docstring says:
Help on method_descriptor:
__array_wrap__(...) a.__array_wrap__(obj) -> Object of same type as a from ndarray obj.
Python type, not numpy dtype. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
On Sat, Apr 26, 2008 at 8:59 PM, Robert Kern <robert.kern@gmail.com> wrote:
On Sat, Apr 26, 2008 at 9:27 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
Because it doesn't do what it says it does.
Here is what the docstring says:
Help on method_descriptor:
__array_wrap__(...) a.__array_wrap__(obj) -> Object of same type as a from ndarray obj.
Python type, not numpy dtype.
So basically it's good for keeping matrices matrices? Chuck
On Sat, Apr 26, 2008 at 10:04 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
On Sat, Apr 26, 2008 at 8:59 PM, Robert Kern <robert.kern@gmail.com> wrote:
On Sat, Apr 26, 2008 at 9:27 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
Because it doesn't do what it says it does.
Here is what the docstring says:
Help on method_descriptor:
__array_wrap__(...) a.__array_wrap__(obj) -> Object of same type as a from ndarray obj.
Python type, not numpy dtype.
So basically it's good for keeping matrices matrices?
Yes, that is what it is used for. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
On Sat, Apr 26, 2008 at 9:29 PM, Robert Kern <robert.kern@gmail.com> wrote:
On Sat, Apr 26, 2008 at 10:04 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
On Sat, Apr 26, 2008 at 8:59 PM, Robert Kern <robert.kern@gmail.com>
wrote:
On Sat, Apr 26, 2008 at 9:27 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
Because it doesn't do what it says it does.
Here is what the docstring says:
Help on method_descriptor:
__array_wrap__(...) a.__array_wrap__(obj) -> Object of same type as a from ndarray
obj.
Python type, not numpy dtype.
So basically it's good for keeping matrices matrices?
Yes, that is what it is used for.
I'm working through the linalg module. There is currently variation as to whether or not eigenvalues/singular_values/residuals, are returned as arrays or as matrices. I'm leaning towards making them all matrices. What do you think? Chuck
On Samstag 26 April 2008, Charles R Harris wrote:
I'm working through the linalg module. There is currently variation as to whether or not eigenvalues/singular_values/residuals, are returned as arrays or as matrices. I'm leaning towards making them all matrices. What do you think?
IMO, the user should only get matrices if he used them to start with. I'm somewhat scared by all the disagreement about matrix semantics, and so if I don't touch matrices myself, I don't want them forced on me, thank you very much. Or, if you prefer a briefer reply: NOoooooooooooooooooooooooooooooooooo! :) Andreas
On Sat, Apr 26, 2008 at 10:31 PM, Andreas Klöckner <lists@informa.tiker.net> wrote:
On Samstag 26 April 2008, Charles R Harris wrote:
I'm working through the linalg module. There is currently variation as to whether or not eigenvalues/singular_values/residuals, are returned as arrays or as matrices. I'm leaning towards making them all matrices. What do you think?
IMO, the user should only get matrices if he used them to start with. I'm somewhat scared by all the disagreement about matrix semantics, and so if I don't touch matrices myself, I don't want them forced on me, thank you very much.
Well, that's what I meant, if not quite what I said.. The question is what they should be when the input is a matrix. Chuck
participants (3)
-
Andreas Klöckner -
Charles R Harris -
Robert Kern