On 5/2/2010 3:58 PM, Robert Kern wrote:
Well, I think we can change zeros_like() and the rest to work around
this issue. Can you bring it up on the numpy mailing list?
def zeros_like(a):
if isinstance(a, ndarray):
res = numpy.empty(a.shape, a.dtype, order=a.flags.fnc)
res.fill(0)
res = res.view(type(a))
return res
...
I'm having difficulty posting to the NumPy list (both via gmane and
email) so I'm just going to put this here so it doesn't get lost.
zeros_like probably needs to call __array_finalize__ for this to work
properly (it'll cause a segfault for me otherwise):
def zeros_like(a):
if isinstance(a, ndarray):
res = numpy.zeros(a.shape, a.dtype, order=a.flags.fnc)
res = res.view(type(a))
res.__array_finalize__(a)
return res
...
- Jim
--
http://mail.python.org/mailman/listinfo/python-list