numpy version and numpy.asarray behavior issue

I have 2 PCs with 2 different installs: ActivePython 2.4.3 Build 12 with numpy version '1.0b1' and Enthought 2.4.3 (1.0.0 #69) with numpy version '0.9.7.2476' The attached runs Ok on numpy v1.0, but on Enthought's, print a1[0] gives: IndexError: 0-d arrays can't be indexed. It seems that the 0.9.7 numpy.asarray is not creating a true array from Dummy class in the code below. Enthought only comes with 0.9.9.2706 (now). When was the asarray behavior supported, or, is there some other issue I'm missing? I'll use Activestate's distro if needed, but I'd like to keep Enthought for that one... def fromaddress(address, dtype, shape, strides=None): """ Create a numpy array from an integer address, a dtype or dtype string, a shape tuple, and possibly strides. """ import numpy # Make sure our dtype is a dtype, not just "f" or whatever. dtype = numpy.dtype(dtype) class Dummy(object): pass d = Dummy() d.__array_interface__ = dict( data = (address, False), typestr = dtype.str, descr = dtype.descr, shape = shape, strides = strides, version = 3, ) return numpy.asarray(d) Thanks, Ray
participants (1)
-
Ray S