[Numpy-discussion] What is __array_wrap__ supposed to do?

Charles R Harris charlesr.harris at gmail.com
Sat Apr 26 22:27:52 EDT 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080426/2d3ceae7/attachment.html>


More information about the NumPy-Discussion mailing list